:scope
Widely availableSince 202088% of users
Targets the element that is the scope of the selector. In stylesheet CSS this is usually the document root. Inside @scope it is the scoped root.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since January 2020. Widely available since July 2022.
See how modern your own CSS is.Check your CSS →
Quick example
:scope {
display: flex;
}
:scope > .item {
flex: 1;
}Examples
Reference the current scope in nested selectors
@scope (.card) {
:scope {
border: 1px solid #ccc;
}
:scope > .title {
font-weight: bold;
}
}:scope refers to the scoped root, useful inside @scope blocks.
Common pitfalls
- :scope is rarely needed outside @scopeIn ordinary stylesheets :scope is usually the document root. Inside an @scope block it is the useful way to style the scoped root itself.
:scope browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2020.Safe to use without fallbacks.
Usage88%of people can use this12% use a browser without it.
Browsers
27+
32+
7+
79+Mobile
27+Android
32+Android
7+iOS