这里是我的小提琴:DIv填充剩余的垂直空间,即使div上面有动态高度?
<div id="wrapper">
<div id="yellow">variable height (I put 200px but can change in realtime)</div>
<div id="red">This one should fill all remaining space, even when yellow resizes</div>
</div>
html, body {
width:100%;
height:100%;
margin:0;
}
#wrapper {
width:100%;
height:100%;
position:relative;
}
#yellow {
width:100%;
height:200px;
background-color:yellow;
}
#red {
position:absolute;
top:200px;
bottom:0;
min-height;250px;
left:0;
width:100%;
background-color:red;
}
这工作好当黄色条具有静态的高度,这是不是在我的情况下工作。
(不使用JS拜托了!)
[重复的问题(HTTP: // STA ckoverflow.com/questions/90178/make-a-div-fill-the-height-of-the-remaining-screen-space) –
或也是这一个http://stackoverflow.com/questions/25098042/fill-剩余的垂直空间与 - CSS-使用-displayflex/25098486 –