我有一个设置高度的 div,它将容纳任意元素和另一个我希望填充剩余空间的 div,以便填充 div。 jsfiddle
html:
<div class=container>
<div class=title>
<h1> title </h1>
</div>
<div class=body>
<h1> stuff here </h1>
</div>
</div>
CSS:
.container {
border: 1px red solid;
height: 300px;
}
.title {
background: blue;
}
.body {
background: green;
}
我希望绿色 div 填充红色边框内的空白区域,使其看起来像这样,但没有明确设置高度,因为标题和包含 div 的大小是动态的。