:local-link
The :local-link
CSS pseudo-class represents a 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
:local-link
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
No specification found
No specification data found for css.selectors.local-link
.
Check for problems with this page or contribute a missing spec_url
to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.
Browser compatibility
No compatibility data found for css.selectors.local-link
.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/:local-link