當有3個物品/ div /元素我怎樣才能讓中間div自動調整到100%的寬度?如何自動調整中間div寬度?
像
<div style="width:500px; height:50px;">
<div style="float:left; width:50px; height:50px; background-color:red;">
a
</div>
<div style="float:right; width:50px; height:50px; background-color:red;">
b
</div>
<div style="width:auto; height:60px; background-color:blue;">
middle
</div>
<div style="clear:both;"></div>
</div>
我不應該使用固定寬度的中間格,作爲家長的div寬度500像素將響應寬,同時改變瀏覽器的大小調整。
我也試着像
不,是行不通的。 – lock 2014-10-04 15:11:02
將佔用瀏覽器寬度的100%,不會隨浮動項目進行調整。 – lock 2014-10-04 15:11:39