Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Pseudo-classes

The :link pseudo-class

Reference for the CSS :link pseudo-class: style hyperlinks that have not been visited, with syntax, the LVHA order, examples, usage notes and browser support.

The :link pseudo-class matches hyperlinks that have an href and have not been visited. In HTML that means <a> and <area> elements with an href attribute whose target is not in the browser's history. Once the user has been to that address, the link matches :visited instead.

An <a> without href is a placeholder and matches neither.

CSS
a:link {
  color: #2563eb;
}

Try it

Unvisited link versus placeholder

Syntax

CSS
:link { /* declarations */ }

No arguments; specificity (0,1,0), the same as :visited, :hover and :active.

Syntax and arguments

Part Description
:link Matches links with an href that the browser has not recorded as visited.
No arguments The pseudo-class is not functional.
Needs An element that is a hyperlink (a[href], area[href]).

Usage notes

  • LVHA order. Write link rules as :link, :visited, :hover, :active. All four have equal specificity, so later rules override earlier ones.
  • Plain a vs a:link. A bare a rule also reaches anchors without href; a:link does not, and it has higher specificity than a.
  • Visited links are special. After a visit the element no longer matches :link. Style shared traits on a or :any-link and only the differences on :link and :visited.
  • Don't rely on colour alone. Links inside text should remain recognisable by an underline or other cue, not just a colour change.
  • Dynamic matching. The state can change during a session, for example when the user returns from a page they just opened.

Browser support

Supported in every browser.