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: Thu, 2 Sep 1999 20:42:02 +0100 (BST)
To: "Braden N. McDaniel" <braden@shadow.net>
cc: "L. David Baron" <dbaron@fas.harvard.edu>, www-style@w3.org, Bert Bos <Bert.Bos@sophia.inria.fr>
Message-ID: <Pine.GSO.4.04.9909022032460.2876-100000@amos.bath.ac.uk>
On Wed, 1 Sep 1999, Braden N. McDaniel wrote:

> > > > 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.
> 
> If a default or user style sheet has a rule like
> 
>   P:hover { color: blue }
> 
> there is *no way* that I can restore P:hover's color to its initial
> behavior, which is for P:hover to effectively inherit its color from P.

The same applies to:

   P.hover { color: blue }

...or:

   P[hover] { color: blue }

If you don't want the color of P elements to differ when they are being
hovered over then use this:

   P, P:hover { color: inherit; }

or

   P, P:hover { color: black; }

Where is the problem?


> CSS selectors have no means of representing that kind of inheritance.
> I think there should be such a thing.

It's not 'inheritance' at all, it's a different selector matching the same
element, and thus being overriden by the cascade. I suggest you propose a
syntax, so that we can more clearly see what you are looking for.

-- 
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 Thursday, 2 September 1999 15:42:08 GMT

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