Re: "Inheriting" from a less-specific selector

On Thu, 26 Aug 1999, Braden N. McDaniel wrote:

> CSS1 has the problem that while inheritance was the effective initial
> value for many properties, there was no way for style sheet authors to
> specify it. So once it had been overridden, there was no way to
> reclaim the inheritance behavior lower in the cascade. CSS2,
> fortunately, fixed this.
>
> With the pseudo-classes ":active", ":hover", and ":focus", CSS2
> introduces the notion that, by "default", these pseudo-classes inherit
> their property values from the next-least-specific selector for an
> element.

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'.)


> 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), then
there is no need for authors to be totally in control of the cascade.

-- 
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 Saturday, 28 August 1999 10:48:55 UTC