::target-text
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The ::target-text CSS pseudo-element represents the text that has been scrolled to if the browser supports scroll-to-text fragments. It allows authors to choose how to highlight that section of text.
::target-text { background-color: pink; }
Syntax
::target-text
Examples
Highlighting scroll-to-text
::target-text { background-color: rebeccapurple; color: white; font-weight: bold; }
To see this CSS in action follow the link to scroll-to-text demo.
Specifications
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
::target-text | 
89  | 
89  | 
No  | 
No  | 
75  | 
No  | 
89  | 
89  | 
No  | 
63  | 
No  | 
15.0  | 
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/::target-text