Re: "Inheriting" from a less-specific selector

On Thu, 26 Aug 1999 04:15:33 -0400 (EDT), "Braden N. McDaniel"
(braden@endoframe.com) wrote:
> But CSS2 has almost exactly the same problem elsewhere!
> 
> 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. But as with the
> "inherit" problem in CSS1, there appears to be no way to recapture this
> behavior once it has been overridden in the cascade.

I'm a little puzzled by this statement.  If the following is in a user
stylesheet:

:link:hover { background: yellow; }

it will (in a browser that supports CSS2) be overridden by the
following statement in an author stylesheet:

:link { background: transparent; }

or even by

* { background: transparent; }

Pseudo-classes are just another part of a selector, and weight and
origin are more important in the cascade than specificity.

Pseudo-elements are a bit more like what you are describing, though.
However, if you want to reset certain properties to their original
state (assuming there aren't any important declarations in a user
stylesheet), you can always do:

*, *:before, *:after, *:first-letter, *:first-line {
  /* everything else you would have put here... */
  content: "";
  }

I would have to say, though, that using pseudo-elements in user or UA
stylesheets probably isn't a good idea, except perhaps for elements
with display list-item (that is, using :before rather than list-style-*
is OK, as long as the :before has 'display: marker' so that it can be
overridden by list-style [1]).

David

[1] http://www.w3.org/TR/REC-CSS2/generate.html#markers

L. David Baron     Rising Sophomore, Harvard     dbaron@fas.harvard.edu
Links, SatPix, CSS, etc.        < http://www.fas.harvard.edu/~dbaron/ >
Summer Intern, Netscape - however, opinions are entirely my own, etc.

Received on Thursday, 2 September 1999 08:52:53 UTC