我試圖創建一個包含三列的頁面。外部列是直接的。但是,中間欄的頂部需要垂直擴展以適應內容,後面跟着另外兩個需要並排放置的div。我的問題是讓頂部div擴大時,兩個較低的div將向下移動。堆疊擴展DIV
爲中軸的核心代碼:
// the top column-wide div
echo '<div id="centre">';
// echo some variable length text
echo '</div>';
// the bottom left div
echo '<div id="centreleft">';
// echo some variable length text
echo '</div>';
// the bottom right div
echo '<div id="centreright">';
// echo some variable length text
echo '</div>';
隨着固定高度的頂部DIV,下面的CSS工作:
#centre {
position: absolute;
left: 230px;
top: 30px;
width: 690px;
overflow: visible;
}
#centreleft {
position: absolute;
left: 230px;
top: 355px;
width: 335px;
overflow: visible;
}
#centreright {
position: absolute;
left: 595px;
top: 355px;
width: 320px;
overflow: visible;
}
什麼我需要改變,以使頂部div是可變高度?我已經嘗試將低位div的位置更改爲相對位置,但隨後所有內容都會寫入屏幕的左上角。
爲什麼[php]標記?附:這些問題在[jsfiddle](http://jsfiddle.net)中的演示效果更好。 – PeeHaa 2012-04-18 19:39:12
您應該發佈HTML格式代替PHP回聲語句。 – Jack 2012-04-18 19:42:25