Sent by Ellen Herzfeld on 17 February 2005 21:09
At 17:50 -0800 16.02.2005, [EMAIL-REMOVED] wrote:
>
>What you are seeing actually doesn't have to do with whether the content
>divs are contained in another div -- it has to do with whether that
>container div has a border around it or not. (If you remove the border, you
>see the same issue as if the container hadn't existed.)
>
>The difference has to do with collapsing margins. This gets pretty complex
>-- I gave a long-winded explanation a while back[1], to which Bob Easton
>also recommended an article from Eric Meyer.[2] Hopefully reading these
>will help make sense to the next paragraphs.
>
>Basically, the border forces the top-margin'ed div to keep that margin
>within the box. Without that, the margin is imposed on the next container's
>margin (in this case, <body>), pushing everything within that container
>down.
[snip]
>
>[1] http://archivist.incutio.com/viewlist/css-discuss/51839
>[2] http://www.complexspiral.com/publications/uncollapsing-margins/
>
Obviously, I forgot to consider the fact that a border would do more
than just add a border...
But even had I found your earlier explanation [1] or (re)read Eric
Meyer's article [2] I'm afraid I wouldn't have realized that the
problem was there. The fact that with the margins "uncollapsed" the
space above the floated div disappears and with margins "collapsed"
the space appears is as unintuitive to me as you can get. Your
explanation that uncollapsing keeps the margin within the box and
collapsing imposes the margin on the next container was very helpful.
Many thanks,
Ellen
--
Quarante-Deux : quelques pages sur la Science-Fiction
Ellen C. Herzfeld - Dominique O. Martel
http://www.quarante-deux.org/
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/