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 Selectorsa: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.
|