:any-link - CSS Selector

Description of the :any-link pseudo-class.

:any-link refers to elements that have an href attribute, that is, the a and area tags, whether these links have been visited or not. For example, :any-link makes writing easier in the case of combined selectors:

Target all the links of the element id="edito" #edito :link, #edito :visited { ... } Can be simplified by using :any-link #edito :any-link { ... }

Example of use of the pseudo-class :any-link.

Basic use of :any-link.

The pseudo-class :any-link is primarily useful for targeting all links, whether they have been visited or not. The example below shows that both links (visited and unvisited) are targeted by the same rule.

This is a link to the  current page 

(always visited).
And here is a link to a  nonexistent page 

(never visited).

Using :any-link on area tags.

Here’s another example of using :any-link: the image below has area type links. On some browsers (like Firefox  ), this feature isn’t implemented.

Firefox Edge Chrome Opera Safari
The main browsers

Browser compatibility with :any-link.

The pseudo-class :any-link is now properly recognized by browsers, except for area type links that Firefox   still doesn't know how to handle (2026).

Column 1
Browser support for the any-link pseudo-class, which targets all links, visited or not.
1
:any-link
pseudo-class
Estimated overall support.
97%

Browsers on computers :

Mobile browsers :

Outdated or marginal browsers :

Internet Explorer

QQ Browser

Safari sur IOS

Firefox pour Androïd

Opéra Mobile

Baidu Browser

KaiOS Browser

UC Browser pour Androïd

Opéra

Safari

Firefox

Chrome pour Androïd

Samsung Internet

Chrome

Edge

Androïd Brower

Opéra mini

Historic of the :any-link pseudo-class.

  • Selectors Level 4

    This specification module defines new selectors that can be used in CSS.

    Regarding :any-link Introduction of the :any-link pseudo-class.
    WD
    September 29, 2011
    Working Draft.
    CR
    PR
    REC

See also...

Several pseudo-classes allow you to target links on a page, or parts of a page specified by the URL (bookmark). Check the pages describing the selectors below to complete your information.

:any-link
Pseudo-class targeting all links (visited or not), in other words, all elements that have an href attribute.
:link
Pseudo-class targeting unvisited hyperlinks.
⚠
:local-link
Pseudo-class targeting internal links, excluding links pointing to another domain.
:target
Langue française
A pseudo-class targeting the element whose id is in the url (bookmark).
::target-text
Langue française
Targets the text of the item designated by the url bookmark.
⚠
:target-within
Langue française
A pseudo-class targeting the parent container of the element whose id is in the url.
:visited
Pseudo-class targeting hyperlinks that have already been visited.