::target-text
Newly availableSince 202494% of users
A pseudo-element that allows you to style text that has been targeted via a URL fragment (the part after the # in a URL). This is often used for 'scrol-to-text' highlights.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since December 2024. Widely available around June 2027.
See how modern your own CSS is.Check your CSS →
Quick example
::target-text {
/* Customizes the highlight color when the user arrives at this specific text via a link */
background-color: var(--brand-highlight);
color: black;
}::target-text browser support
BaselineNewly availableSince 2024 this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.Works in all modern browsers. May need a fallback for older browsers.
Usage94%of people can use this6% use a browser without it.
Browsers
89+
131+
18.2+
89+Mobile
89+Android
131+Android
18.2+iOS