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;
}

Examples

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




SHARE THIS PAGE

Color Picker

colorpicker