固定的高度和100%的高度我試圖讓div擴展到100%的高度與滾動條的底部仍然可見,當還包含一個固定的高度股利。有人可以幫助我:)集裝箱DIV
當使用波紋管佈局時,.div2底部的垂直滾動條脫離視點的高度,我猜是因爲.div1是200px高,推div1到100%身高+ 200px。
有沒有一種方法可以使.div1爲固定高度,並且.div2擴展爲填充剩餘窗口高度並在達到該高度時溢出。
這裏是CSS
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
overflow:hidden;
}
.container
{
height:100%;
}
.leftContent {
left:0;
top:0;
padding:0;
width:250px;
height:100%;
color:white;
background:blue;
overflow:hidden;
border:blue solid;
}
.div1
{
height:200px;
background-color:black;
border: red solid;
}
.div2
{
overflow:scroll;
height:100%;
border:yellow solid;
}
這裏是HTML。
<div id="container" class="container">
<!-- Start Left Column-->
<div id="leftColumn" class="leftContent">
<div id="div1" class="div1">
CONTENT
</div>
<div id="div2" class="div2">
START START START START START START START START START START START START START START START START
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT CONTENT
END END END END END END END END END END END END END END END END END END END END END END END END
</div>
</div>
<!-- End Left Column-->
</div>
非常感謝。 感謝
感謝您的回覆。似乎在IE中不能正常工作:(儘管在FireFox中正確渲染,IE不會溢出,但不會在.div2上設置高度:100%,並且當你執行滾動條底部時仍然存在相同的問題。建議? – Lukie 2010-02-08 14:15:51
我將.div2封裝在一個外部div中,所以'START .... etc'內容不在.div2(
IE瀏覽器總是很難:)內容「START ..」應該保留在'.div2'中 – 2010-02-08 15:09:43