开发者

height of div equals to "0"

I have a very si开发者_运维技巧mple html code:

<body>
        <div id="container">
            <div id="left">
                some text here
            </div>
            <div id="right">
                and some text here
            </div>
        </div>
    </body>

and styles:

div#left {
    float: left;
    background: #e2e2e2;
}

div#right {
    float: right;
    background: #1469ab;
}

I want to have the height of div #container equal to heights of it's content, but now it actually 0. How to implement this behavior?


you should apply a non-structural clearing to the container like easyclearing http://www.positioniseverything.net/easyclearing.html

otherwise you can also specify height: auto; overflow: hidden to the container


add overflow:auto to your #container

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜