内联块扩展高度父容器

时间:2011-12-10 14:51:51

标签: html css

我有2个div元素并排设置为内联块。它们都位于包含div中。我已将正确的div设置为高度100%,但因为包含div的高度是动态的,所以它不会扩展。有谁知道如何让右手div(coulmn)扩展到包含div的动态高度?

<div class="container">
<div class="left_column">Dynamic Content In Here</div>
<div class="right_column">Side bar to expand to the height of the containing div</div>
</div>

由于

奥利弗

3 个答案:

答案 0 :(得分:3)

在遇到同一问题的一些问题之后,在我看来,最简单的解决方案是使用table-cell作为显示属性。它工作得很好!

答案 1 :(得分:2)

我认为您搜索的内容如下:

.container {
    min-height: 700px;
}

.right_column {
    min-height: inherit;
}

另见jsfiddle

答案 2 :(得分:0)

尝试添加:

html, body
{
  height:100%;
}

#container
{
 min-height:100%;
}
相关问题