Sub topic 12
Browser support and fallback strategy
This chapter assumes you know how @scope rules, scope roots, scope limits and :scope work from the earlier chapters. It also assumes you know basic cascade behavior. Here you decide whether to ship @scope today, and how to keep the page usable where it is missing.
What the support picture looks like
@scope reached browsers in stages:
| Browser | First version with `@scope` |
|---|---|
| Chrome and Edge | 118 (October 2023) |
| Safari | 17.4 (March 2024) |
| Firefox | 146 (December 2025) |
Check MDN or caniuse for current numbers before you commit to a policy. Support data changes, and your own analytics decide what "supported enough" means for your site.
What an unsupporting browser does
A browser that does not know @scope treats it as an unknown at-rule. It skips the whole block, including every rule inside it. No error appears, and the page loads normally.
The effect is that none of the styles inside the block apply. A .card that depends on @scope (.card) { img { width: 100%; } } shows full-size images in an old browser. The fallback question is therefore what the page looks like with the block removed.
Strategy 1: progressive enhancement
Write plain selectors that work everywhere. Then add @scope for the parts that benefit from it, such as donut exclusions.
/* Baseline: every browser */
.card img {
width: 100%;
}
.card a {
color: rebeccapurple;
}
/* Enhancement: only browsers with @scope */
@scope (.card) to (.card-content) {
img {
border-radius: 50%;
}
}The baseline carries the layout. The rounded images are decoration, so losing them in an older browser costs little. This works best when you can name which rules are essential and which are polish.
Strategy 2: duplicate the rule with an equivalent selector
Some @scope behavior has a close plain-CSS equivalent. A donut scope can be approximated with :not() and a complex selector:
.card img:not(.card-content img) {
border-radius: 50%;
}
@scope (.card) to (.card-content) {
img {
border-radius: 50%;
}
}Both rules match the same images in this markup, so every browser gets the result. The cost is that you now maintain two versions. They also differ in specificity and cascade. The plain selector gains specificity from .card and from the :not() argument. The @scope rule does not gain any from its root. Scope proximity also has no plain-CSS equivalent. Use this approach for a few critical rules, not for a whole stylesheet.
Strategy 3: detect support and branch
You can check from JavaScript whether the browser knows the rule type. Browsers with @scope expose the CSSScopeRule interface.
if (typeof CSSScopeRule === "undefined") {
document.documentElement.classList.add("no-scope");
}Your stylesheet can then target the no-scope class for fallback rules:
.no-scope .card img {
width: 100%;
}This adds a script dependency and a flash of unstyled content if the script runs late. Prefer strategies 1 and 2 when the fallback can be pure CSS.
Testing the fallback
Test the fallback directly, because you cannot see it in a modern browser by default.
- Open your page in a browser or version without
@scope, or use a testing service. - Alternatively, temporarily rename
@scopeto@scope-offin your stylesheet. Browsers skip the unknown rule the same way. - Check that text is readable, layout is intact, and no interactive control is hidden or broken.
Choosing a policy
- Ship
@scopealone if your audience uses current browsers, such as an internal tool. - Use progressive enhancement for public sites with mixed browsers.
- Keep BEM, CSS Modules or Shadow DOM where they already work. They do not depend on
@scopesupport, and you do not need to replace them.
Exercise
A stylesheet's only image rule is @scope (.card) { img { width: 100%; } }. In a browser without @scope, what happens to the images, and how would you fix it using progressive enhancement?
Show answer
The browser skips the whole @scope block as an unknown at-rule, so the width: 100% rule never applies and the images show at their natural size. Add a baseline rule outside the block, such as .card img { width: 100%; }, so every browser gets the layout. Keep @scope only for refinements such as donut exclusions.