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>, <area>, or <link> element that has an href attribute. Thus, it matches all elements that match :link or :visited.

/* Selects any element that would be matched by :link or :visited */
:any-link {
  color: green;
}

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

Specification Status Comment
Selectors Level 4
The definition of ':any-link' in that specification.
Working Draft Initial definition.

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
:any-link 65
65
1
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
79
79
79
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
50
50
1 — 50
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
No 52
52
15
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
9
9
3
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
1.2 — 3
Prefixed
Prefixed Implemented with the vendor prefix: -khtml-
Mobile
Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
:any-link 65
65
≤37
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
65
65
18
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
50
50
4 — 50
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
47
47
14
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
9
9
1
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-
9.0
9.0
1.0
Prefixed
Prefixed Implemented with the vendor prefix: -webkit-

See also

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