Share this Page URL

Glossary > Glossary - Pg. 261

262 Learn HTML 4 In a Weekend <style type="text/css"> body { color: navy; background: #ffffcc; } a:link { color: #006699; background: transparent; font-weight: bold; } a:visited { color: #006699; background: transparent; font-weight: bold; } a:hover { color: red; background: yellow; font-weight: bold; } a:active { color: purple; background: transparent; font-weight: bold; } h1 { color: blue; background: transparent; font-size: 42px; font-family: Arial, Geneva, Helvetica, sans-serif; } Notice that the same color was set for both unvisited links ( a:link ) and visited links ( a:visited ). That was because Internet Explorer defaults to displaying internal links, even if they haven't been clicked on, as visited links, whereas other browsers display them as unvisited links. The a:active and a:hover pseudo-classes are listed after the other anchor pseudo-classes. If they are listed before any of the other anchor pseudo- classes, they won't be displayed. Notice also that a:active follows a:hover ; if they are inserted the other way around, with a:hover follow- ing a:active , the properties assigned to a:active won't be displayed (which may be how you want it, however). Background color (#ffffcc) a:link and a:visited color (#006699) a:hover colors (red foreground and yellow background) Text color (navy) Figure 8.7 Text, link, and background colors are set for the document, using styles alone.