::selection
Limited availability82% of users
A pseudo-element that styles the part of a document that has been highlighted by the user (usually by clicking and dragging with the mouse).
What's modern
From web-features, MDN's browser data and our snippets, checked dailyComingNot in yet, so not every major browser supports it.
See how modern your own CSS is.Check your CSS →
Quick example
::selection {
/* Changes the default blue highlight color to your brand color */
background: var(--brand-accent);
color: white;
}::selection browser support
BaselineLimited availabilityThis feature is not Baseline because it does not work in some of the most widely-used browsers.Not ready for production without a fallback.
Usage82%of people can use this18% use a browser without it.
Browsers
1+
62+
1.1+
12+Mobile
18+Android
62+Android