Using Classes with Pseudo-Classes


Class selectors can be combined with pseudo-classes to create links for different purposes. For example, you might want to style links depending on whether they are internal or external.

A class could be added to all external links, and then these links could be styled using a combined class and pseudo-class selector as shown in Listing 10.3. The results can be seen in Figure 10.1.

Listing 10.3. CSS Code Demonstrating Combined Class and Pseudo-Class Selectors
a:link {     color: blue; } a:visited {     color: purple; } a.external:link {     color: red;     font-weight: bold; } a.external:visited {     color: black;     font-weight: bold; } 

Figure 10.1. Screenshot showing difference between a:link and a.external:link.





Sams Teach Yourself CSS in 10 Minutes
Sams Teach Yourself CSS in 10 Minutes
ISBN: 0672327457
EAN: 2147483647
Year: 2005
Pages: 234
Authors: Russ Weakley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net