Highlighting a range of text inside a form field

Title “Using the OpaqueRange API with the CSS Custom Highlight API” with parts of it highlighted in pink and green, the author’s photo, three code blocks, and “olliewilliams.xyz”.

Ollie Williams shows how the new OpaqueRange extends the CSS Custom Highlight API into form controls. Call createValueRange() on a <textarea> or on a text, password, search, tel, or url <input>, pass the result into a Highlight(), and register it with CSS.highlights.set(). In ::highlight() you get color, background-color, text-decoration, and text-shadow. Chromium 152 only for now.

olliewilliams.xyz/blog/opaquerange