Applying Styles to Hyperlinks

By default in most browsers, textual hyperlinks appear as underlined blue text, and visited hyperlinks (that is, hyperlinks to pages you have already visited) appear as underlined purple text. You have probably seen Web sites where this wasn’t the case, though, and perhaps wondered how they did it.

Hyperlink formatting can be controlled by placing arguments in the <a> tag for each link, although it’s tedious to do so. For example, to make an individual hyperlink magenta:

<a href="foliage.htm" style="color: magenta">Diagnosing Foliage Problems</a>

You could apply a class to all hyperlinks, as you learned in the preceding section, but that method does not provide a way to distinguish between the visited and the unvisited ...

Get HTML and XHTML Step by Step now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.