我希望我的内容区域伸展到父的高度,我对标题区域的固定高度。我无法对内容区域的高度进行硬编码,因为在我工作的情况下,父区域的高度可能会发生变化。拉伸格于母公司的高度
HTML:
<div class="parent">
<div class="title">Title</div>
<div class="content">
<p>My Content</p>
</div>
</div>
CSS:
.parent{
width : 500px;
height: 300px;
background-color : gray;
position: absolute;
}
.title{
height:50px;
background-color: #94A6E0;
margin:5px;
}
.content{
background-color: #8CBF99;
margin:5px;
}
的jsfiddle:http://jsfiddle.net/PGJJv/
正是我想要的!谢谢 – janith
表格在IE7上失败 – Dipak
不客气。 @Dipaks:我知道,但OP没有指定浏览器支持。已添加到我的答案额外的信息。 – Kyle