Skip to: content, navigation

by Tommy Olsson and Paul O’Brien

:visited (CSS selector)

Browser support full matrix
IE7+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full
Spec
Version
CSS1

Example

This rule will set the font color of all visited HTML links to #cccccc:

a:visited {
  color: #cccccc;
}

Try it yourself!View all demos

Description

This pseudo-class matches link elements that are determined to have been visited.

In CSS1, this pseudo-class applied only to a elements that had an href attribute (that is, a hypertext link). In CSS2, the document language can define elements as hyperlink anchors. It’s up to the user agent to decide which links it considers to be visited and unvisited.

The two pseudo-classes :link and :visited are mutually exclusive: a link is either visited or unvisited. As such, a selector like a:link:visited should never match any element.

Compatibility

IE5.5Buggy
6.0Buggy
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

Neither Internet Explorer 5.5 nor 6 supports the chaining of pseudo-classes; only the last pseudo-class is honored in these browsers.

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters