W3C home > Mailing lists > Public > www-style@w3.org > November 1998

Re: Colors of collapsed margins

From: L. David Baron <dbaron@fas.harvard.edu>
Date: Thu, 19 Nov 1998 16:46:42 -0500 (EST)
Message-Id: <199811192146.QAA13928@login6.fas.harvard.edu>
To: www-style@w3.org
Cc: py8ieh=www-style@bath.ac.uk
>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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:56 GMT