开发者

Floating left and parent height

开发者 https://www.devze.com 2023-01-09 15:07 出处:网络
This has probably been answered before, but I have spent some time looking and can\'t find an exact answer.

This has probably been answered before, but I have spent some time looking and can't find an exact answer.

I have a parent div A that contains two divs B and C.

B and C are both floated left. C has no set height (grows w/ amount of text in it).

The problem: the parent A does not grow to the size of C. I know this has something to do with floating an element not being a part of the normal 开发者_运维技巧document flow, but I don't know how to fix it (setting a height on A doesn't help since it depends on the height of C).


add the property overflow:hidden to div A


a small div with clear:both after B and C (inside A) should do the trick

0

精彩评论

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