::selectionLimited availability
The ::selection CSS pseudo-element selects text a user has highlighted.
Not yet supported in all major browsers — check the table and provide a fallback.
Browser support
DesktopChrome
1+Supportedsince Dec 11, 2008
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1–61Not supported
62+Supportedsince Sep 5, 2018
Current: 157Safari
1–1Not supported
1.1+Supportedsince Oct 24, 2003
Current: 27MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155Firefox Android
4–61Not supported
62+Supportedsince Sep 5, 2018
Current: 157Safari iOS
✕Not supportedup to 27
Current: 27How to use
Not supported in Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.
Example
Full syntax and examples are on MDN: ::selection.
Feature detection
CSS · check before using
@supports selector(::selection) {
/* styles that use ::selection */
}
/* or in JavaScript */
if (CSS.supports("selector(::selection)")) {
// use it
}