CSS2 » Other » visited

Version: Level 1

Compability: IE4+  N6+

Syntax:
visited

The visited pseudo-class is used to apply style to a link element after that link has been visited by the user. Commonly, a visited link will be assigned a different color than an unvisited link. This makes it very easy for a user to determine which links have or have not been visited. (Note: the fact that a link has been visited is stored in the browser history. If the history is plurged, the fact that the link has been visited may be lost and the link will be treated as unvisited.)

All together, there are four pseudo-classes that are reserved for use with the HTML anchor tag (a). They are used to assign any appropriate CSS property:value pair to a link. Most typically, they are used to designate a font color, or background color, or to remove the underline.

A pseudo-class is assigned to a selector via following syntax:

selector:pseudo-class { property: value; ...; }

A pseudo-class can also be used with the value assigned as a class to a selector:

selector.class:pseudo-class { property: value; ...; }

Examples

Code:
a:active { background-color: RGB(100, 14, 107); text-decoration: none; }
a:hover { color: red; text-decoration: none; }
a:link { color: teal; text-decoration: none; }
a:visited { visibility: hidden; }
Language(s): CSS2
Code:
a.example:visited {color: yellow; text-decoration: none;}
 
<a class="example" href="http://www.facade.com/biorhythm/" target="_blank">Biorythem</a>
Output:
Biorythem
Explanation:

Click on the link and then come back to this page. Note that the link is now a yellow text.

Language(s): CSS2

See Also: