Previous Message
Next Message

Re: [css-d] Pseudo class

Sent by Eric A. Meyer on 24 January 2002 18:06


>I have a question about link presentation pseudo-classes. On the 
>W3.org page (http://www.w3.org/TR/REC-CSS2/selector.html) they show 
>the following example:
>
>A.external:visited { color: blue }
>
>The :visited class the last part of the selector. Now since this is 
>from The Standards I follow this, but quite often I am finding sites 
>using:
>
>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.
    Pseudo-elements, on the other hand, must ALWAYS come at the end of 
the selector.  So you can't write 'p:first-line em', because the 'em' 
incorrectly comes after the pseudo-element ':first-line'.

--
Eric A. Meyer [EMAIL-REMOVED]) http://www.meyerweb.com/eric/
Author, "Cascading Style Sheets: The Definitive Guide" and
"CSS 2.0 Programmer's Reference"  http://www.meyerweb.com/eric/books/
Previous Message
Next Message

Message thread:

Possibly related: