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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.