Open this example in the interactive library
Source code
<style>
.demo::selection {
background-color: #fde68a;
color: #451a03;
}
</style>
<p class="demo">Select a few words in this sentence.</p>
Highlight text selection with native CSS. The preview includes a small shared demo stylesheet.
Open this example in the interactive library
<style>
.demo::selection {
background-color: #fde68a;
color: #451a03;
}
</style>
<p class="demo">Select a few words in this sentence.</p>