The :local-link
CSS pseudo-class represents an link to the same document. Therefore an element that is the source anchor of a hyperlink whose target’s absolute URL matches the element’s own document URL.
/* Selects any <a> that links to the current document */ a:local-link { color: green; }
Syntax
Syntax not found in DB!
Examples
HTML
<a href="#target">This is a link on the current page.</a><br>
<a href="https://example.com">This is an external link</a><br>
CSS
a:local-link {
color: green;
}
Result
Specifications
Specification | Status | Comment |
---|---|---|
Selectors Level 4The definition of ':local-link' in that specification. | Working Draft | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
No compatibility data found. Please contribute data for "css.selectors.local-link" (depth: 1) to the MDN compatibility data repository.
See also
:local-link by Mozilla Contributors is licensed under CC-BY-SA 2.5.