:scope (pseudo-class)Baseline · Widely available
The :scope CSS pseudo-class matches the scoping root, for instance the element that querySelector() is called on, or the root of a DOM subtree specified with @scope.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jan 15, 2020. Widely available since Jul 15, 2022.
Browser support
DesktopChrome
1–26Not supported
27+Supportedsince May 21, 2013
Current: 155Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154Firefox
1–31Not supported
32+Supportedsince Sep 2, 2014
Current: 157Safari
1–6Not supported
7+Supportedsince Oct 22, 2013
Current: 27MobileChrome Android
18–26Not supported
27+Supportedsince May 22, 2013
Current: 155Firefox Android
4–31Not supported
32+Supportedsince Sep 2, 2014
Current: 157Safari iOS
1–6Not supported
7+Supportedsince Sep 18, 2013
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: :scope.
Feature detection
CSS · check before using
@supports selector(:scope) {
/* styles that use :scope */
}
/* or in JavaScript */
if (CSS.supports("selector(:scope)")) {
// use it
}Documentation (MDN)
Specification
Sub-features
Support for each part of the feature (2). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| scope | 27 | 79 | 32 | 7 | 27 | 32 | 7 |
| scope.dom_api | 27 | 79 | 32 | 7 | 27 | 32 | 7 |