Previous Message
Next Message

Re: [css-d] Pseudo class

Sent by Mark Newhouse on 24 January 2002 18:06

on 1/24/02 4:40 PM, Eric A. Meyer at [EMAIL-REMOVED] wrote:

>> A:visited.external { color: blue }
>> ! Does anyone know where this syntax has risen from. It does seem to
>> work in browsers... but is it "legit"?
> In CSS2, it is legal to use either approach.  CSS1 only permitted
> the first syntax ('a.class:visited') and not the second, so some
> browsers from that era might not know what to do with a pseudo-class
> that comes before the class value.  More recent browsers (or sloppily
> written browsers from the pre-CSS2 era) should handle both.


Related to this question, but indirectly, I have begun to write my style
sheets with the environment in mind. To elaborate:

If I have a navigation menu that uses different :link, :visited, and :hover
psuedo-classes from the rest of the links on the page, instead of applying a
class of, say, .nav to each psuedo-class, a la:

  a.nav:link {color: blue;}
  a.nav:visited {color: red;}
  a.nav:hover {color: green;}

I write a DIV around the menu:

  #nav {border: 1px solid black;}

and then the psuedo-classes:

  #nav a:link {color: blue;}

This way my links don't have to have the class="nav" attribute in them.

  [a href="x.html"] vs. [a href="x.html" class="nav"]

It makes more sense to me to have the links behave a certain way because
they are in a DIV#nav or a DIV#content, rather than assigning each link a
class to get it to behave the way I want it to.

Makes writing the HTML more straightforward as well...


--Mark Newhouse
  We put the "blah" in blog...
Previous Message
Next Message

Message thread:

Possibly related: