:local-link - CSS Selector

:local-link pseudo-class - Description.

The pseudo-class :local-link âš  refers to links that point to the same domain as the page they're on. For now, this selector is poorly supported by browsers (2026).

The result should look like this (this is a simulation). The pseudo-class :local-link lets us automatically add a little symbol ( đź”— ) to external links.

This link points to another
page of this site index.

This link points to the
homepage of đź”— Google.

:local-link pseudo-class - Examples of use.

Below, the two examples shown make a distinction between local links (same domain) and external links (different domains) by adding the đź”— character before external links. More specifically, we add the symbol to all links and remove it for local links.

This example will only work on browsers that recognize the pseudo-class :local-link.

:local-link pseudo-class - Browser compatibility

The pseudo-class :local-link isn't supported by browsers yet (2026).

:local-link pseudo-class - Historic.

  • Selectors Level 4

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

    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.