【发布时间】:2013-02-08 08:40:54
【问题描述】:
HTML
<div class="container">
<div class="a">dummy content</div>
<div class="b"></div>
</div>
CSS
.container {
height: 200px; /* Fixed height */
}
.a {
height: auto; /* Dynamic height */
}
.b {
height: 100%; /* I want this to fit inside .container, relative to .a */
}
当 .a 获得例如 100px 的动态高度时,我希望 .b 为 .container 高度 - 100px。我希望这使用纯 CSS 自动发生。
请看我的 jsFiddle:http://jsfiddle.net/59MKS/。
如果能提供任何帮助,我将不胜感激。
【问题讨论】:
-
你想在class-b框中添加一些内容吗?
-
@mayaa 是的,应该可以包含一些内容。
标签: css size containers stretch html