<div style="width:90%; margin:0 auto;">
<div style="width:200px; float:right;">右側固定內容</div>
<div style="margin-right:210px;">左側自適應內容</div>
</div>
<div style="width:90%; margin:0 auto;">
<div style="width:150px; float:left;">左側固定內容</div>
<div style="margin-left:160px;">右側自適應內容</div>
</div>
<div style="width:90%; margin:0 auto;">
<div style="width:150px; float:left;">左側固定內容</div>
<div style="width:200px; float:right;">右側固定內容</div>
<div style="margin-left:160px; margin-right:210px;">中間自適應內容</div>
</div>
可利用負的 margin-bottom 搭配大的 padding-bottom,再以外層容器隱藏溢出部分,讓三欄背景高度一致。
*{margin:0;padding:0;}
#content{overflow:hidden;}
#content #left,#content #center,#content #right{
margin-bottom:-10000px;
padding-bottom:10000px;
width:300px;
float:left;
}
#content #left{background:#f00;}
#content #center{background:#0ff;}
#content #right{background:#f0f;}
這種方式適合需要等高背景但不想依賴表格的版面。