Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Early CSS defined four ways to match a link based on its navigation and interaction state: `:link` for an unvisited destination, `:visited` for one the user had visited, `:hover` while the pointer was over it, and `:active` during activation. The CSS2 standard treated these states as mutually exclusive, but visited-link styling is now restricted because it can expose browsing history.

What did the four CSS link states mean?

CSS2 described four anchor pseudo-classes. They let authors apply different styles depending on whether a link had been visited or was being interacted with. The standard explicitly said, “The four states are mutually exclusive.” — W3C, CSS2 selector text, §5.10.5.

  • :link matched a link before its destination had been visited.
  • :visited matched a link after its destination had been visited.
  • :hover matched while the user designated the link without activating it.
  • :active matched during activation.

CSS2 gave the states this preference order when considering overlap: :active, :hover, :visited, then :link. It also noted that a user agent could eventually return a visited link to the unvisited state, so visited status was not necessarily permanent.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which HTML elements could match link states?

The HTML 5.1 selector-matching rules say that a, area, and link elements with an href attribute must match one of :link or :visited. The specification also acknowledges that more specific rules may mitigate privacy concerns. See HTML 5.1: Matching HTML elements using selectors.

#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Why is the CSS rule order different from CSS2’s preference order?

For author stylesheets, the familiar order is :link, :visited, :hover, :active—often shortened to LVHA. This is a cascade convention, not a replacement for CSS2’s description of link-state precedence. When selectors have equal specificity, a later rule can override an earlier one, so placing hover and active rules later lets those interaction styles take precedence.

a:link { color: blue; }
a:visited { color: purple; }
a:hover { text-decoration: underline; }
a:active { color: red; }

This example shows selector ordering only; it does not claim to reproduce every browser’s default link appearance. MDN documents the recommended ordering in its references for :link and :visited.

Why can’t a website freely inspect visited links?

A page that could determine which links a person had visited could infer parts of that person’s browsing history. Current specifications and browser behavior therefore limit how visited history is matched, what visual changes authors may apply, and what scripts can observe.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Selectors Level 4 describes a visited-history model scoped by destination URL, the origin of the page that initiated navigation, and the top-level site. Its examples explain how scoping helps prevent cross-site tracking through embedded frames.

Rank #3
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

MDN’s :visited reference describes practical safeguards:

  • Only a limited set of color-related properties can be affected by :visited.
  • Alpha behavior is constrained.
  • getComputedStyle() exposes the non-visited value.
  • DOM selector APIs do not reveal whether an element matched :visited.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What can the early standards tell us about browser history?

The CSS2 text establishes the selector meanings and its stated overlap rules. It does not establish which browser first implemented these pseudo-classes or provide a reliable browser-by-browser adoption chronology. A timeline of individual browser releases would require dated implementation records beyond these standards references.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.