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

--- "Braden N. McDaniel" <braden@endoframe.com> wrote:
> 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.
There are potentially differing interpretations of
this pargraph, and as with other areas of the spec it
is somewhat ambiguous.

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.

However, it is certainly true that the alternative is
better, even if it is not necessarily logical.
> 
> > > 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.
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.



=====
----------------------------------------------------------
From Matthew Brealey (http://members.tripod.co.uk/lawnet (for law)or http://members.tripod.co.uk/lawnet/WEBFRAME.HTM (for CSS))
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

Received on Wednesday, 10 November 1999 06:04:15 UTC