XML technologies / CSS / CSS Cookbook / General information / Different selectors for assigning styles / Pseudo-classes
(Excerpt from “CSS Kochbuch” by Christopher Schmitt)
Sometimes you want to style elements selected on a basis other than their names, attributes or content. This example uses pseudo-classes to create rollover effects:
a:link {
color: blue;
}
a:visited {
color: purple;
}
a:hover {
color: red;
}
a:active {
color: gray;
}In this example, a link normally appears in blue. When the pointer moves over it, it turns red. While it is being clicked, it appears grey. Returning to the page after visiting the link displays it in purple.
Three further pseudo-classes are :first-child, :focus and :lang(n).
Copyright of the German edition © 2007 by O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “CSS Kochbuch” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstr. 81, 50670 Köln
back to top