CSS :visited Pseudo-class
More "Try it Yourself" examples below.
Definition and Usage
The CSS :visited
pseudo-class is used to style visited links.
Tip: Use :link to style links to unvisited pages, :hover to style links when you mouse over them, and :active to style links when you click on them.
Note: To style links appropriately, put the :visited rule after the :link rule, but before the :hover and :active rules.
Allowed styles are:
- color
- background-color
- border-color (and border-color for separate sides)
- outline color
- column-rule-color
- text-decoration-color
- text-emphasis-color
- SVG attributes fill and stroke
Version: | CSS1 |
---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the pseudo-class.
Pseudo-class | |||||
---|---|---|---|---|---|
:visited | 1 | 12 | 2 | 3.1 | 9.6 |
CSS Syntax
:visited {
css declarations;
}
More Examples
Example
Select and style unvisited, visited, hover, and active links:
/* unvisited link */
a:link {
color: green;
}
/* visited link */
a:visited {
color: green;
}
/* mouse over link */
a:hover {
color: red;
}
/* selected link */
a:active {
color: yellow;
}
Try it Yourself »
Example
Style links with different styles:
a.ex1:hover, a.ex1:active {
color: red;
}
a.ex2:hover, a.ex2:active {
font-size: 150%;
}
Try it Yourself »
Related Pages
CSS tutorial: CSS Links
CSS tutorial: CSS Pseudo classes