Open Find in page — Ctrl+F / ⌘F and search for “highlight”.
Editorial demo
Use find in page to highlight repeated words in an article.
Scope
A specific selector can highlight only this block, while the global selector acts across the whole page.
HTML
Copy HTML
<p>Open Find in page — Ctrl+F / ⌘F and search for “highlight”.</p><sectionclass="search-text"><div><h2>Editorial demo</h2><p>Use find in page to highlight repeated words in an article.</p></div><div><h2>Scope</h2><p>A scoped selector targets this block, while the global selector can style every search match on the page.</p></div></section>
Tailwind CSS
Copy Tailwind
Some classes with arbitrary values can be replaced by native classes, depending on the value and your Tailwind CSS configuration.
<p>Open Find in page — Ctrl+F / ⌘F and search for “highlight”.</p><sectionclass="[&_::search-text]:bg-[#d9fff0] [&_::search-text]:text-[#18352b] [&_::search-text]:underline [&_::search-text]:text-shadow-[0_0_3px_#8ee9c0] [&_::search-text:current]:bg-[#ffcf5a] [&_::search-text:current]:text-[#231500] [&_::search-text:current]:underline [&_::search-text:current]:decoration-wavy [&_::search-text:current]:text-shadow-[0_0_7px_#ff8a00]"><div><h2>Editorial demo</h2><p>Use find in page to highlight repeated words in an article.</p></div><div><h2>Scope</h2><p>A scoped selector targets this block, while the global selector can style every search match on the page.</p></div></section>