coderef

: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: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–31Not supported
32+Supportedsince Sep 2, 2014
Current: 157
Safari
1–6Not supported
7+Supportedsince Oct 22, 2013
Current: 27
MobileChrome Android
18–26Not supported
27+Supportedsince May 22, 2013
Current: 155
Firefox Android
4–31Not supported
32+Supportedsince Sep 2, 2014
Current: 157
Safari iOS
1–6Not supported
7+Supportedsince Sep 18, 2013
Current: 27

How 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-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
scope277932727327
scope.dom_api277932727327