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

negating CSS pseudo-classes

From: Adam M. Costello <amc@CS.Berkeley.EDU>
Date: Sat, 20 Feb 1999 22:29:17 +0000
To: www-style@w3.org
Message-ID: <19990220222917.C12058@u29.CS.Berkeley.EDU>
[Sorry if this has been mentioned before--I'm new to the list.]

Today I thought of a case where it would be useful to be able to negate
a pseudo-class.  Suppose I want some links to be "subtle" in the sense
that I don't want them to be rendered specially until the mouse moves
over them, at which time I want them to look like ordinary links.  (For
example, maybe every word with a glossary entry links to the entry, and
they would be too distracting if rendered specially).

I could mark subtle links by including the word "subtle" in their class
attributes.  Then I'd like to be able to say:

    .subtle:!hover { color: inherit; text-decoration: inherit }

Notice the "!" in front of "hover".  Without this capability, I would
have to explicitly set the appearance of links, which I might prefer to
leave unspecified:

    :link, :visited       { text-decoration: LINKDECOR }
    :link                 { color: LCOLOR }
    :visited              { color: VCOLOR }
    .subtle               { color: inherit; text-decoration: inherit }
    .subtle:hover         { text-decoration: LINKDECOR }
    .subtle:link:hover    { color: LCOLOR }
    .subtle:visited:hover { color: VCOLOR }

(LINKDECOR, LCOLOR, and VCOLOR stand for particular values of the
appropriate types.)

Of course, if we allow negation of pseudo-classes, maybe we should also
allow negation of attribute selectors.  Possible syntax:


I don't know whether any of this would impose difficult burdens on
layout engines.

Received on Saturday, 20 February 1999 17:29:22 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:49 UTC