negating CSS pseudo-classes

[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:

    .!foo
    [!whatever]

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

AMC

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