2
我發現了幾個關於100%身高和粘腳的教程。 但是,我無法實現100%高度的右側欄。 我的側邊欄的高度似乎與邊欄內的內容相關,即使它設置爲100%。 有什麼建議嗎?css右邊欄高度100%
這裏是我的html
<body>
<div id="container">
<div id="header">
</div>
<div id="wrap">
<div id="sidebar-right">
<div id="menu">
lorem ipsum
</div>
</div>
<div id="content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus adipiscing, nunc quis vehicula vehicula, mi nunc tempor lorem, nec congue augue neque vitae augue.
</div>
<div class="push"></div>
</div>
<div class="footer">
</div>
</body>
和CSS
html, body{margin: 0; padding: 0; height: 100%;}
#sidebar-right{
background: #ccc;
float: right;
height: 100%;
width: 300px;
border-left: 2px #fff solid;
}
#container{
height: auto !important;
margin: 0 auto -142px;
min-height: 100%;
}
#wrap {
height: 100%;
overflow: hidden;
}
#menu {margin: 150px 0 0 50px;}
.footer {
background: none repeat scroll 0 0 #BA6F19;
clear: both;
height: 100px;
position: relative;
}
#header {
background: none repeat scroll 0 0 #BA6F19;
height: 50px;
padding: 20px;
}
#content {
float: right;
margin-top: 100px;
width: 400px;
height: 100%
}
.footer, .push {
height: 142px;
}
謝謝,但它還沒有解決問題。你可以看到這裏的網站:http://tndsigns.com/test/height/ – jon1010 2012-07-21 12:34:25
我認爲你可以使高度:400px。 (我對不起,所以我的英語不好) – user1542575 2012-07-21 15:01:48
這也不管用,因爲它會使它固定高度。 – jon1010 2012-07-21 15:16:08