使子div与自动高度父div一样高

时间:2010-12-19 06:42:25

标签: html css

我有一个包装元素,其中包含两个浮动元素contentArea和sidebar。 contentArea具有最多内容,因此确定包装元素的高度。我希望侧边栏也能触及包装div的底边。我怎么做。这是一个基本的wordpress博客布局。

HTML:

<div id="wrapper" class="clearfix">
    <div id="content">
        GROWS REALLY TALL AS HAS SO MUCH CONTENT
        GROWS REALLY TALL AS HAS SO MUCH CONTENT
        GROWS REALLY TALL AS HAS SO MUCH CONTENT
        GROWS REALLY TALL AS HAS SO MUCH CONTENT
        GROWS REALLY TALL AS HAS SO MUCH CONTENT
    </div>
    <div id="sidebar">
        WANT'S TO BE AS TALL AS CONTENT.
        height:100%;   /*  doesn't work  */
    </div>
</div>

CSS:

#wrapper{
    height:auto;
    width:100%;
}
#content{
    height:auto;
    width:625px;
}
#sidebar{
    height:100%;
    width:335px;
}

感谢所有帮助。

由于

1 个答案:

答案 0 :(得分:6)

that您要找的是什么?