On 2007-10-07, Ben C. <ben (AT) example (DOT) net> wrote:
Quote:
Hi
If I have a container div and inside the container div I float two divs
(one left and one right), the containting div will collapse as the
floated divs will no longer prop it up, meaning that any background
colour or image on the containing div will not be visible.
Now, suppose I put left and right padding on the containing div. How
come, if the containing div has collapsed, does the padding of the
container still apply to the two nested floated divs? |
The container still has all its padding. Its top, left and right padding
will be above, to the left and to the right of the floats inside.
It's just that its auto height calculation (if it has auto height)
doesn't take account of the floats.
Quote:
It seems as though the floated divs are 'inside' the container in some
ways, but not inside the container in other ways (they don't prop it
up). Is there some simple way to think of this so it all makes sense? |
The explanation you've given is OK-- they start inside but end outside.