我有一個容器div,其內容有時需要除以class="top"
和class="bottom"
。顯然沒有float:top
或float:bottom
,那麼單獨使用html/css來實現這個目標的最好方法是什麼?頂部和底部包含div的位置div
例:
<div class="content">
<div class="left">
<a href="#"><img src="img/home.jpg" alt="salon home"></a>
</div><!-- end left -->
<div class="center">
<a href="#" class="top"><img src="img/about.jpg" alt="about salon"></a>
<a href="#" class="bottom"><img src="img/services.jpg" alt="salon service"></a>
</div><!-- end center -->
<div class="right">
<a href="#" class="top"><img src="img/products.jpg" alt="salon products"></a>
<a href="#" class="bottom"><img src="img/contact.jpg" alt="contact salon"></a>
</div><!-- end right -->
</div><!-- end content -->
#container .content {
margin-top: 115px;
}
#container .content .left {
float: left;
width: 307px;
}
#container .content .center {
float: left;
padding-left: 19px;
width: 307px;
}
#container .content .right {
float: right;
width: 307px;
}
ETA - FIDDLE - http://jsfiddle.net/FaTxw/2/
絕對定位? – j08691
@ j08691會禁用'float:right'和'float:left',否? – AMC
您是否正在嘗試強制將'放在最前面,並將''放在最下面?很難確定你想從你的問題得到的確切結果。 – Axel