Styling Hyperlinks

This example demonstrates how to add different styles to hyperlinks:

HTML file: Displayed by browser:
<style>
a.one:link { color:#ff0000; }
a.one:visited { color:#0000ff; }
a.one:hover { color:#ffcc00; }
a.two:link { color:#ff0000; }
a.two:visited { color:#0000ff; }
a.two:hover { font-size:150%; }
a.three:link { color:#ff0000; }
a.three:visited { color:#0000ff; }
a.three:hover { background:#66ff66; }
a.four:link { color:#ff0000; }
a.four:visited { color:#0000ff; }
a.four:hover { font-family:monospace; }
a.five:link { color:#ff0000;text-decoration:none; }
a.five:visited { color:#0000ff;text-decoration:none; }
a.five:hover { text-decoration:underline; }
</style>
<body>
<p>Mouse over the links (DO NOT CLICK ON THEM) and watch the change:</p>
<p><b><a class="one" href="text_hey.html" target="_blank">This link changes color</a></b></p>
<p><b><a class="two" href="text_hey.html" target="_blank">This link changes font-size</a></b></p>
<p><b><a class="three" href="text_hey.html" target="_blank">This link changes background-color</a></b></p>
<p><b><a class="four" href="text_hey.html" target="_blank">This link changes font-family</a></b></p>
<p><b><a class="five" href="text_hey.html" target="_blank">This link changes text-decoration</a></b></p>
</body>

Mouse over the links (DO NOT CLICK ON THEM) and watch the change:

This link changes color

This link changes font-size

This link changes background-color

This link changes font-family

This link changes text-decoration


Back button Table of Contents Next button