CSS Pseudo-Classes

Pseudo-Classes are used to assign special effects to to ID, class and element selectors - as defined here. While a number of pseudo-classes exist, only a few of them are consistently implemented by the major web browsers.

Many, but not all, of these pseudo-class behaviors have been implemented in IE7. However, they only manifest themselves if the strict HTML DTD is used. It should also be noted that the range of CSS properties that can be modified in a pseudo-class declaration is only a subset of all available properties for the class. The precise subset is browser-dependant. We have also noted that IE does not always like being given shorthand property declarations such as border:0.05em gray solid inside a pseudo-class declaration.

The fact that IE6 does not fully support pseudo-classes is truly lamentable since pseudo-classes offer an elegant way of accomplishing a number of display features such as interactive buttons, pop-down menus etc. IE7 does redress the situation but it will be a while yet before one can safely design for IE7 rather than its predecessor.

A related concept is that of pseudo-elements which enable additional effects to be applied to page layout. The :first-letter and :first-line pseudo-elements are of particular interest. As their names imply, they are used to style the first letter or line of a block element.

Finally, why the term pseudo ? The reasoning is that these specifications allow the designer access to those parts of a web page that would not otherwise be accessible via the use of standard HTML. It should be noted that many pseudo effects can be delivered by other means - by using JavaScript and/or by using inline elements such as span.

Jump To...

Colophon