+-------------+ +---------------------------------+
| | | |
| 1 | | |
| left-nav | | |
| | | |
+-------------+ | 3 |
| | | |
| | | |
| 2 | | very long contents here |
| | | which causes to scroll |
| other | | vertical bar. Setting |
| remaining | | this content to 100% height? |
+-------------+ +---------------------------------+
什麼是身高:100%;其實?它應用於頁面窗口還是滾動結束? 我有以下的HTML ...如何設置滾動高度?
<div id="wrapper">
<div id="left-nav">
<!--contents of 1-->
</div>
<div id="yourad">
<!--contents of 2--->
</div>
<div id="main-contents">
<!--contents of 3-->
</div>
</div>
我的CSS如下....
#wrapper{position: relative; width: 1007px; margin: 0 auto;}
#left-nav{width: 329px; height: 100%; background: grey;float: left;}
#yourad{height: 100%; background: blue;}
#main-contents{margin-left: 329px; padding: 10px; background: pink;}
****注:****
第一眼看到我的演示,以瞭解我的問題Here
1實際高度的內容我不知道。
2實際高度的內容:我不知道。
3實際高度的內容:我不知道。
因爲我可能需要一些頁面少一些內容和一些頁面更多的內容。
我試過在html,body,wrapper,left-nav,yourad中使用height: 100%;
,但是無法成功。
你有沒有試着用'溢出玩:隱藏;'和'溢出-Y:scroll'? – slamborne 2013-03-14 02:46:14
溢出:隱藏;我用過,但溢出 - Y:滾動,我不知道這件事。 – 2013-03-14 02:53:59
這是你所追求的嗎? http://jsfiddle.net/Y7PhV/105/ – slamborne 2013-03-14 02:58:00