Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

:visited

Matches links the user has already opened; `:link` matches those not yet visited.

Syntax

a:visited { … }

Examples

Visited links are purple:

<style>
  a:link { color: royalblue; }
  a:visited { color: purple; }
</style>
 
<p><a href="#">This page (already visited)</a></p>
<p><a href="https://example.com/never-opened-12345">A page you have not opened</a></p>

Notes

For privacy, browsers allow only colors to change in :visited — color, background-color, border-color, outline-color. Sizes, images and other properties are ignored.

See also

  • :hover — Matches an element while the mouse pointer is over it.
  • <a> — A link to another page, a file or a place on the page.

Related recipes

In the tutorial

  • Pseudo-classes — Styles for element states and positions — hover, focus, links, first-child, nth-child, not and form fields.

Thanks for reading!

Donate to the site — we work hard for you.