Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS :link selector

CSS :link selector

Complete CSS SelectorComplete CSS Selector Reference Manual

Example

Select the style of unvisited links:

a:link

{

background-color:yellow;

}

Try it »


Definition and Usage

:link adds a special style to unvisited links.

Note: The :link selector has no style for already visited links.

Tip: Use :visited The selector sets the style of visited page links,:hoverThe selector styles links when the mouse hovers over them,:active The selector sets the style when you click a link.


Browser support

The numbers in the table indicate the first browser version that supports this property.

Selector
:link 4.0 7.0 2.0 3.1 9.6

Related pages

CSS Tutorial: CSS Links

CSS Tutorial: CSS Pseudo classes


More examples

Example

Active, visited, unvisited, or links with the mouse hovering over them:

a:link    {color:green;}

a:visited {color:green;}

a:hover   {color:red;}

a:active  {color:yellow;}

Try it »

Example

Links with different styles:

a.ex1:hover,a.ex1:active {color:red;}

a.ex2:hover,a.ex2:active {font-size:150%;}

Try it »


CSS element,element Selector

Complete CSS SelectorComplete CSS Selector Reference Manual