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

On Wed, 10 Nov 1999 03:04:14 -0800 (PST),
=?iso-8859-1?q?Matthew=20Brealey?= ( wrote:
> --- "Braden N. McDaniel" <> wrote:
> > On Mon, 8 Nov 1999, Matthew Brealey wrote:
> > > CSS 2 spec (at
> > >, 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;">
<!-- collapsed margin of 1em is here -->
  <div style="background: blue; margin-top: 1em;">
    <div style="margin-top: 1em;">

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


     and responses

L. David Baron    Sophomore, Harvard (Physics)
Links, SatPix, CSS, etc.     <URL: >
WSP CSS AC                      <URL: >

Received on Wednesday, 10 November 1999 09:18:48 UTC