Re: "Inheriting" from a less-specific selector

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 UTC