我有一個基於表格的佈局,100%的高度/寬度沒有滾動條。標題(紅色)自動擴展以適應內容,我不知道它會有多少像素。下面的流體表給出了我究竟是什麼。如何將此基於表格的佈局轉換爲CSS?
<html>
<body height=100%>
<table height=100% width=100% padding=0>
<tr height=1><td colspan=2 bgcolor=red>Fit<br/>to<br/>content<br/>height</td></tr>
<tr><td bgcolor=blue width=66% valign=top>How can I do this with CSS?</td><td bgcolor=green valign=top>
<div style="height:100%; width:100%; overflow:auto;">
This area can have content that overflows - needs an independent scrollbar.<br/>
0<br/>1<br/>2<br/>3<br/>4<br/>5<br/>6<br/>7<br/>8<br/>9<br/>
0<br/>1<br/>2<br/>3<br/>4<br/>5<br/>6<br/>7<br/>8<br/>9<br/>
0<br/>1<br/>2<br/>3<br/>4<br/>5<br/>6<br/>7<br/>8<br/>9<br/>
0<br/>1<br/>2<br/>3<br/>4<br/>5<br/>6<br/>7<br/>8<br/>9<br/>
</div>
</td></tr>
</table>
</body>
</html>
如何在CSS中執行相同的佈局並使其在常用的瀏覽器上工作?
我複製/粘貼它,我似乎並沒有做你想在Firefox 3.5中。綠色的側邊欄應該有一個滾動條,身體不應該,對吧? – Alsciende 2009-07-31 09:37:02
是的,它應該。我還沒有在這臺機器上安裝FF3.5。我需要這樣做 - 謝謝你告訴我。 – Andrew 2009-08-01 12:42:03