W3cubDocs

/CSS

:any-link

The :any-link CSS pseudo-class selector represents an element that acts as the source anchor of a hyperlink, independent of whether it has been visited. In other words, it matches every <a> or <area> element that has an href attribute. Thus, it matches all elements that match :link or :visited.

Try it

Syntax

:any-link {
  /* ... */
}

Examples

HTML

<a href="https://example.com">External link</a><br />
<a href="#">Internal target link</a><br />
<a>Placeholder link (won't get styled)</a>

CSS

a:any-link {
  border: 1px solid blue;
  color: orange;
}

/* WebKit browsers */
a:-webkit-any-link {
  border: 1px solid blue;
  color: orange;
}

Result

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
:any-link 651 7979 501–50 No 5215 931.2–3 65≤37 6518 504–50 4714 91 9.01.0
not_match_link 65 79 87 No 52
NoSafari currently matches <link> elements with link pseudo-classes. See Bug: 220740.
65 65 87 47
NoSafari currently matches <link> elements with link pseudo-classes. See Bug: 220740.
9.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/:any-link