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

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

From: Braden N. McDaniel <braden@endoframe.com>
Date: Mon, 8 Nov 1999 17:16:34 -0500 (EST)
Message-ID: <Pine.LNX.4.10.9911081703160.25989-100000@bonezero.endoframe.com>
To: Matthew Brealey <thelawnet@yahoo.com>
cc: www-style@w3.org
On Mon, 8 Nov 1999, Matthew Brealey wrote:

> --- "Braden N. McDaniel" <braden@endoframe.com> wrote:
> > On Mon, 8 Nov 1999, Matthew Brealey wrote:
> > 
> > >
> > ---------------------------------------------------
> > > Margin-color:
> > > 
> > > It has always been a mystery to me why the CSS
> > spec
> > > states that margins are always transparent. This
> > means
> > > that you have to do this:
> > > BODY {background-color: black}
> > > DIV {margin-left: 5%;
> > > margin-right: 5%;
> > > background-color: red}
> > > <body>
> > > <div>
> > > </div>
> > > </body>
> > 
> > For this specific case, the same effect could be
> > achieved with
> > 
> >   html { background-color: black; }
> >   body {
> >     margin-left: 5%;
> >     margin-right: 5%;
> >     background-color: red;
> >   }
> > 
> CSS 2 spec (at
> http://www.w3.org/TR/REC-CSS2/colors.html#q2), section
> 14.2)
> <blockquote>
> For HTML documents, however, we recommend that authors
> specify the background for the
> BODY element rather than the HTML element. User agents
> should observe the following
> precedence rules to fill in the background: if the
> value of the 'background' property for the HTML
> element is different from 'transparent' then use it,
> else use the value of the 'background' property for
> the BODY element. If the resulting value is
> 'transparent', the rendering is undefined. 
> </blockquote>
> 
> I may be misunderstanding what is said, but it seems
> to me that this states that BODY's and HTML's margins
> are equivalent, with HTML's given priority.

What that says, basically, is that the "root" background (the canvas) will
be filled by background for the BODY element, *unless* a background for
HTML is specified, in which case that value should be used.

This is consistent with the intuitively expected behavior for the example
I gave.

> > If margins weren't transparent, why have margins at
> > all? 
> 1. So that you can have space both inside the border
> and outside it.
> 
> 2. Because they collapse. (On which topic, it needs to
> be decided what colour the adjoining vertical margins
> would be. There are a number of options:
> 1. In proportion the different colours.
> 2. Only allow margin-color on BODY.
> 3. Only apply the colour of the larger margin, with
> equal margins applying the uppermost one.
> 4. Only apply the colour of the uppermost margin.
> )
> I propose 3.

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.

-- 
Braden N. McDaniel
braden@endoframe.com
<URL:http://www.endoframe.com>
Received on Wednesday, 10 November 1999 04:36:53 GMT

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