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

Re: Margin-color; text-indent; browser detection without script; attribute selector, ! combinator

From: L. David Baron <dbaron@fas.harvard.edu>
Date: Wed, 10 Nov 1999 09:18:43 -0500 (EST)
Message-Id: <199911101418.JAA24591@is01.fas.harvard.edu>
To: thelawnet@yahoo.com, www-style@w3.org
On Wed, 10 Nov 1999 03:04:14 -0800 (PST),
=?iso-8859-1?q?Matthew=20Brealey?= (thelawnet@yahoo.com) wrote:
> 
> --- "Braden N. McDaniel" <braden@endoframe.com> wrote:
> > On Mon, 8 Nov 1999, Matthew Brealey wrote:
> > > CSS 2 spec (at
> > > http://www.w3.org/TR/REC-CSS2/colors.html#q2), section
> > > 14.2)

[4th paragraph of section 14.2 snipped]

> There are potentially differing interpretations of
> this pargraph, and as with other areas of the spec it
> is somewhat ambiguous.

I think it means exactly what it says, and nothing more.  Note that
"use it" means to use it as the background for the initial containing
block, which the previous paragraph says covers the entire canvas.

However, there are a number of other problems with this paragraph.  See
[1] for a description of other problems.

> I still think that this is saying that HTML and BODY
> are equivalent, and consistent with this view is the
> fact that the HTML element does not take the style,
> class or id attributes. In addition, I see HTML's role
> as nothing more than a holder for the whole document
> rather than an element.

The CSS2 spec is quite clear that HTML is part of the rendering tree.
As Ian pointed out in [2], section 9.1.2 [3] says that:

#  The root of the document tree generates a box that serves as the
#  initial containing block for subsequent layout.

> > I have also been unable to find a good answer in the
> > spec about which
> > margin color "wins" when margins are collapsed; but,
> > as you note, settling
> > this would require additional verbiage. Simply
> > giving the option of opaque
> > margins wouldn't settle the issue.
> Actually this will never be the case.
> 
> Margins only collapse when a margin-bottom and a
> margin-top are adjacent. The colour of margins is that
> of the parent element.
> 
> There is never a situation were adjacent vertical
> margins do not share a parent.

No, Braden is right.  Any adjacent vertical margins collapse.  This
means the following four margins (those given in style attributes)
collapse (assuming no borders or padding):

<body style="background: white;">
  <div style="background: red; margin-bottom: 1em;">
    <div style="margin-bottom: 1em;">
    </div>
  </div>
<!-- collapsed margin of 1em is here -->
  <div style="background: blue; margin-top: 1em;">
    <div style="margin-top: 1em;">
    </div>
  </div>
</body>

Braden was asking whether the collapsed margin is red, blue, or
white.  As I said in my previous message [4], it's white.

David

[1] http://lists.w3.org/Archives/Public/www-style/1999Sep/0026.html
     and responses
[2] http://lists.w3.org/Archives/Public/www-style/1999Sep/0035.html
[3] http://www.w3.org/TR/REC-CSS2/visuren.html#containing-block
[4] http://lists.w3.org/Archives/Public/www-style/1999Nov/0073.html

L. David Baron    Sophomore, Harvard (Physics)    dbaron@fas.harvard.edu
Links, SatPix, CSS, etc.     <URL: http://www.fas.harvard.edu/~dbaron/ >
WSP CSS AC                      <URL: http://www.webstandards.org/css/ >
Received on Wednesday, 10 November 1999 09:18:48 GMT

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