开发者

Div with height is 0px, it does not grow in relation to their children

开发者 https://www.devze.com 2023-03-12 08:13 出处:网络
I have the div div.home-top with two other divs div#home-content as float:left and div#home-buttons as float:right.

I have the div div.home-top with two other divs div#home-content as float:left and div#home-buttons as float:right.

And below the div#home-top got the div#home-footer as clear:both

My 开发者_开发问答div#home-top is the minimum size. I put it in red, but I can not see it. How to make the div#home-top take on the height divs children. See the code.


Add overflow: hidden; to the CSS for div#home-top:

div#home-top
{
    background-color:Red;
    overflow: hidden;
}

JS Fiddle demo


Floated divs have no height, so .home-top does not expand. You will need to give it an explicit height or unfloat the inner elements.

0

精彩评论

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