I can’t seem to auto-grow my parent div
’s height based on its floating child div
s. All the children are floating, to take up space horizontally, and then wrapping to the next line. There can be a changing number of floating children, and the parent has to auto-size its height. (The parent div
serves as a background for all the floating div
s). There is also a second div
below the parent div
that needs to be pushed down, so that it is below the floating div
s.
It’s of major importance that the solution works in IE.
If the parent container only has floating children, it will have no height. Adding the following CSS to the parent container should help:
.parent {
overflow:hidden;
width: 100%;
}
Read this article for more: http://www.quirksmode.org/css/clearing.html.