demo · v135

Style your find-in-page

Chrome 135 exposes browser find-in-page hits as a CSS highlight pseudo: ::search-text and ::search-text:current. Pick a style preset and type a query — the simulator below renders the same effect in any browser so you can see what the rule will look like once Chrome ships it.

::search-text in this browser: ?

The web platform's text rendering can be remarkably nuanced. Picking which text the user is looking for, and styling it so it stands out without ruining the page's typography, is exactly the kind of thing that should be CSS-controllable rather than baked in. Find-in-page highlights have lived for two decades in the same washed-out yellow, regardless of whether the page's palette could even support it. The text you're searching for might be the user's input, your own keyword, or a translated string.

This block of text is intentionally long enough to contain several matches for common queries. Try the word "text" or "the" or "page" and watch the highlights move as you click "next match".

/* generated stylesheet */

see also