views:

12

answers:

2

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).

+1  A: 

add the property overflow:hidden to div A

Catfish
It's good practice to avoid adding non-semantic divs whenever possible (as per second's suggestion below), so Catfish's overflow:hidden; suggestion is a better solution. More details and compatibility info at http://gtwebdev.com/workshop/floats/enclosing-floats.php
peterjmag
A: 

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

second