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

Re: "Inheriting" from a less-specific selector

From: Ian Hickson <py8ieh@bath.ac.uk>
Date: Wed, 1 Sep 1999 20:29:31 +0100 (BST)
To: "Braden N. McDaniel" <braden@endoframe.com>
cc: www-style@w3.org, Bert Bos <Bert.Bos@sophia.inria.fr>
Message-ID: <Pine.GSO.4.04.9909012011220.2603-100000@ss1.bath.ac.uk>
On Wed, 1 Sep 1999, Braden N. McDaniel wrote:

> > CSS1 has this 'problem' too, and there is no need to invoke pseudo
> > classes to demonstrate it: this is the whole idea of the cascade.
> >
> > For example:
> >
> >    P EM { color: red }
> >    STRONG EM { color: green }
> >
> >    <P> <STRONG> <EM> green </EM> </STRONG> </P>
> >
> > How can you make an EM in a STRONG be the same color as an EM _not_ in a
> > STRONG, without knowing what the colour of an EM not in a strong would
> > normally be? You can't. (You could override the later rule by using
> > !important, and you could change the order, but that is 'cheating'.)
> 
> Ah, right you are. I don't buy, though, that this is the "whole idea of the
> cascade."

Ok, not the _whole_ idea, but a major part of it, anyway.

The fact that a later rule 'overrides' an earlier rule of the same weight,
specificity and origin and matching the same element is an important part
of it the cascade.

Another, even simpler example:

   P { color: red; color: green; }

The second declaration overrides the first. That is elementary cascadics. 

 
> > > For the "cascade" concept to work where the state of the cascade is not
> > > known in advance, it is imperitive that style sheet authors always be
> > > able to restore the cascade to a defined state.
> >
> > Not IMHO. So long as users and UAs write stylesheets that are self-
> > consistent and responsible (see David's piece, quoted earlier today),
> 
> Are you suggesting that it is reasonable for context selectors to be "off
> limits" for default and user stylesheets?

On the whole, probably. You should ask David, he is more of an expert on
user stylesheets than I...


> > there is no need for authors to be totally in control of the cascade.
> But the fundamental folly of the assumption that browser designers
> will ensure that they use friendly default stylesheets is soundly
> demonstrated by the current crop of UA default stylesheets.

I disagree. The problem at the moment is not the UA stylesheets, but the
CSS engines in the UAs. The CSS engines at the moment are not always
predictable. It also appears that they have some rules in their virtual
ua.css files that are not codifiable in CSS. (Witness the strange
behaviour of the TABLE element in recent browsers... The problem is _not_ 
that the TABLE element simply has non-inherit rules in the ua.css file!)

-- 
Ian Hickson
: Is your JavaScript ready for Nav5 and IE5?
: Get the latest JavaScript client sniffer at 
: http://developer.netscape.com/docs/examples/javascript/browser_type.html
Received on Wednesday, 1 September 1999 15:29:34 GMT

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