CSS :link Selector


Example

Select and style unvisited links:

a:link {
  background-color: yellow;
}
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The :link selector is used to select unvisited links.

Note: The :link selector does not style links you have already visited.

Tip: Use the :visited selector to style links to visited pages, the :hover selector to style links when you mouse over them, and the :active selector to style links when you click on them.

Version: CSS1

Browser Support

The numbers in the table specifies the first browser version that fully supports the selector.

Selector
: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


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.