The :any-link pseudo-class in CSS provides a method for selecting elements that are the source anchor of a hyperlink.
If the term source anchor lost you, that’s a fancy name for the href attribute on the HTML elements , and
An element that accepts and contains a href attribute is a hyperlink and will be selected with :any-link. This becomes a handy way of selecting all link-based HTML elements that might otherwise appear unrelated and without touching the markup. Perhaps it exists because you might think :link would select all links, but it misses :visited, so this wraps them all up together.
Functionally, it’s just like the attribute selector [href].
See the Pen :any-link by CSS-Tricks (@css-tricks) on CodePen.
It’s worth noting that we could also select the same HTML elements using the :matches() pseudo-class. For example, :matches(:link, :visited) will select the same elements as :any-link.
Another thing to note is that the spec is currently asking for alternative name suggestions for this selector at the time of this writing. While it’s unclear if the name will change, the :matches() pseudo-class was formerly named :any() which could be an indication.
The :any-link pseudo-element is considered an experimental feature and is part of the Selectors Level 4 specification, which is currently in working draft status.
For full support you’d want to use it prefixed:
And remember not to comma-separate those selectors to combine them, as browsers toss selectors with parts they don’t understand.
Selectors Level 4 Specification (Working Draft)