CSS Pseudo-Class Tutorial

How to set the color of a link with CSS: link, visited, hover, active

The code below shows you how to set the color of a link with CSS: link, visited, hover, active.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>Web Development Tutorials.com</title>

<style type="text/css">
a:link {color: #FF0000;}
a:visited {color: #00FF00;}
a:hover {color: #FF00FF;}
a:active {color: #0000FF;}

</style>

</head>
<body>
<p>
<a href="http://webdevelopmenttutorials.com/">http://webdevelopmenttutorials.com/</a>
</p>
</body>
</html>

NOTE: "a:hover" has to come after "a:link" and "a:visited" in order for it to work.

Note: "a:active" has to come after "a:hover" in order for it to work.

The code above creates the link below:

http://webdevelopmenttutorials.com/

Use the text editor below to practice what you have learned.