CSS :link Pseudo-class
More "Try it Yourself" examples below.
Definition and Usage
The CSS :link
pseudo-class is used to select and
style unvisited links.
Note: The :link pseudo-class does not style links that have already been visited.
Tip: Use :visited to style links to visited pages, :hover to style links when you mouse over them, and :active to style links when you click on them.
Note: :link
MUST come before :hover
(if present) in the CSS
definition in order to be effective!
Version: | CSS1 |
---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the pseudo-class.
Pseudo-class | |||||
---|---|---|---|---|---|
:link | 4.0 | 7.0 | 2.0 | 3.1 | 9.6 |
CSS Syntax
:link {
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