Re: Colors of collapsed margins

>From www-style-request@w3.org  Thu Nov 19 16:18:48 1998
>From: Ian Hickson <py8ieh@bath.ac.uk>
>To: "L. David Baron" <dbaron@fas.harvard.edu>
>Subject: Re: Colors of collapsed margins
>
>On Thu, 19 Nov 1998, L. David Baron wrote:
>> These situations involve layered block level elements, for example
>> "<DIV> <UL> ... </UL> </DIV> <DIV> <UL> ... </UL> </DIV>".  In these
>> situations, it is possible that each margin does not have the same
>> color, since the DIV may have a background color different from that of
>> DIV's parent.
>
>Err, why is the DIV's own background important when it comes to drawing
>the DIV's margins?
>
>The color of ANY margin, colapsed or not, is that of the parent's
>background. Since for two margins to collapse they MUST have the same
>parent (eg, you cannot colapse with your parent's margins), then there is
>no problem, is there? If I've missed something, draw an ASCII art
>diagram...

There are *four* margins being collapsed here into one.  Two of them
are the UL margins, which have the background color of the DIV.  The
other two are the DIV margins, which have the background color of the
BODY.  (Believe it or not, this is supported by MSIE (with some bugs),
Opera, and NGLayout.)

*Any* adjacent vertical margins in the normal flow are collapsed.  This
means that the margins of nested elements are collapsed if they are not
separated by border, padding, or content.  (I don't really like this
rule, because of this problem, which it creates.  Just collapsing
bottom / top would be easier, and I think makes more sense.)

David

--------------------------------------------------------------------
L. David Baron         | Freshman, Harvard
dbaron@fas.harvard.edu | < http://www.fas.harvard.edu/~dbaron/ >
Webmaster, International Weather Satellite Imagery Center, etc.
--------------------------------------------------------------------

Received on Thursday, 19 November 1998 16:46:43 UTC