Testing

CSS Cascade Layers: Browser Support, Syntax, Use Cases

CSS cascade layers (@layer) work in Chrome 99+, Edge 99+, Firefox 97+, Safari 15.4+, Opera 86+, and Samsung Internet 18+. See full browser support and syntax.

Author

Prince Dewani

May 6, 2026

CSS cascade layers are an at-rule from the W3C CSS Cascading and Inheritance Level 5 specification that group style rules into ordered buckets so layer order beats selector specificity. They work in Chrome 99+, Edge 99+, Firefox 97+, Safari 15.4+ on macOS and iOS, Opera 86+, and Samsung Internet 18+, while Internet Explorer never shipped support.

This guide covers what CSS cascade layers are, the browsers that support them, how to use the @layer at-rule, the use cases, and the known issues.

What is CSS Cascade Layers?

CSS Cascade Layers are explicit specificity buckets defined by the W3C in CSS Cascading and Inheritance Level 5. The @layer at-rule declares a layer and sets its order in the cascade, so the last declared layer wins over earlier ones, regardless of selector specificity.

Which browsers does CSS Cascade Layers support?

Cascade layers ship by default in every modern engine. The Web Platform Baseline marks @layer as Widely Available across Chromium, Gecko, and WebKit, with Internet Explorer the only major engine that never added the feature.

Loading browser compatibility data...

CSS Cascade Layers compatibility in Chrome

Chrome supports cascade layers from Chrome 99 on Windows, macOS, Linux, ChromeOS, and Android. Chrome 96 to 98 had @layer disabled by default behind the Layered API flag in chrome://flags, and Chrome 4 to 95 did not support it at all.

CSS Cascade Layers compatibility in Edge

Microsoft Edge supports cascade layers from Edge 99 on Windows, macOS, and Linux through its Chromium pipeline. Edge 96 to 98 mirrored Chrome's flagged behavior, and Edge 12 to 95 dropped @layer rules as unrecognized syntax.

CSS Cascade Layers compatibility in Firefox

Firefox supports cascade layers from Firefox 97 on Windows, macOS, Linux, and Android. Firefox 94 to 96 kept @layer behind the layout.css.cascade-layers.enabled flag in about:config, and Firefox 2 to 93 ignored the at-rule and every nested declaration inside it.

CSS Cascade Layers compatibility in Safari

Safari supports cascade layers from Safari 15.4 on macOS Monterey and from Safari 15.4 on iOS and iPadOS 15.4. Safari 3.1 to 15.3 on macOS and Safari 3.2 to 15.3 on iOS treated @layer as unknown CSS, so every rule inside a layer was discarded.

CSS Cascade Layers compatibility in Opera

Opera supports cascade layers from Opera 86 on Windows, macOS, and Linux through its Blink engine. Opera 9 to 85 did not support the at-rule, and Opera Mobile picked up support from Opera Mobile 64 on Android in line with the Chromium update.

CSS Cascade Layers compatibility in Samsung Internet

Samsung Internet supports cascade layers from Samsung Internet 18 on Galaxy phones and tablets through its Chromium base. Samsung Internet 4 to 17 did not parse @layer, so any rules inside a layer were silently dropped on those builds.

CSS Cascade Layers compatibility in Android Browser

Modern Android WebView and Chrome for Android support cascade layers from Chrome 99 forward. The legacy stock Android Browser (2.1 to 4.4.4) did not support @layer at all, so any traffic from those devices needs a no-layers fallback stylesheet.

CSS Cascade Layers compatibility in Internet Explorer

Internet Explorer 5.5 through Internet Explorer 11 never added support for the @layer at-rule. Microsoft has retired Internet Explorer, so any legacy intranet pages that still need styling have to use Edge or Edge IE Mode and skip cascade layers entirely on the IE Mode path.

Note

Note: CSS cascade layers behave differently across Safari before 15.4, flag-gated Chromium builds, and modern engines. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!

How do you use the @layer at-rule?

Declare layer order once at the top of your stylesheet, then add rules into each named layer. Browsers stack the layers in the order you listed them, so the last one wins for normal declarations.

  • Declare layer order: Put a single @layer statement at the top of your stylesheet listing every layer name in priority order, lowest to highest. Example: @layer reset, base, components, utilities;.
  • Add rules into a named layer: Wrap each block of rules in @layer name { ... }. Reopening the same name later appends rules to the existing layer instead of creating a new one.
  • Import third-party CSS into a layer: Use @import url(framework.css) layer(framework); to drop a vendor stylesheet into your own layer order so its rules cannot outrank your overrides.
  • Nest layers when you need sub-buckets: Write @layer framework.components or nest @layer blocks. Nested layers form a parent.child path that orders only inside the parent, so other parents stay untouched.
  • Detect support before shipping: Wrap a fallback in @supports not (at-rule(@layer)) { ... } so Safari 15.3 and earlier still get a usable stylesheet without duplicating every rule.

Verify the order is doing the work in DevTools by inspecting the Computed pane and checking the Specificity column for the @layer label next to the winning rule.

/* 1. Declare layer order up front. The first layer has the lowest priority. */
@layer reset, base, components, utilities;

/* 2. Add rules into each layer. */
@layer reset {
    * { margin: 0; padding: 0; box-sizing: border-box; }
}

@layer components {
    .button { padding: 12px 20px; border-radius: 8px; background: #2b6cb0; color: #fff; }
}

@layer utilities {
    /* Wins over .button even though the selector is less specific. */
    .text-center { text-align: center; }
}

/* 3. Detect support before falling back. */
@supports not (at-rule(@layer)) {
    /* Older Safari and Firefox land here. */
    .button { padding: 12px 20px; border-radius: 8px; background: #2b6cb0; color: #fff; }
}
...

What are the use cases of CSS cascade layers?

Cascade layers solve specificity problems that used to require !important, deep selectors, or build-time tricks. Most teams adopt them on design systems, vendor stylesheets, and theming code where override order has to be predictable.

  • Design systems: Put tokens, base, components, and utilities in named layers so a one-class utility always beats a complex component selector without bumping specificity.
  • Third-party vendor CSS: Import Bootstrap or a UI kit into a low-priority layer with @import url(...) layer(vendor); so your own rules win without copying every selector.
  • Tailwind CSS v4: Tailwind ships native @layer theme, base, components, and utilities. User overrides land in the right slot automatically, replacing the v3 build-time directive.
  • Theming and dark mode: Group every theme variation in a theme layer that loads after the base layer. Switching themes becomes a layer swap instead of a specificity escalation war.
  • Legacy CSS migration: Drop a legacy stylesheet into a low-priority layer while you rewrite the new system in a higher layer. Old rules keep working until each one is replaced.

What are the known issues with CSS cascade layers?

Cascade layers ship widely but still surprise teams that move from a flat stylesheet to a layered one. Most of the bugs come from interactions with !important, unlayered styles, and older Safari builds that drop every rule inside an unknown @layer block.

  • Unlayered styles always win: Any rule outside a @layer beats every rule inside a layer. A stray global selector in your reset will silently override a utilities layer until you move it into a layer too.
  • !important reverses the order: Important declarations make the first layer win, not the last. Teams who use !important inside utilities expecting it to dominate end up with reset rules winning instead.
  • Safari 15.3 drops layered rules entirely: Older Safari does not parse @layer, so every rule inside the block is discarded. Without a @supports fallback, iOS users on iOS 15.3 and earlier see a broken page.
  • Anonymous layers cannot be reopened: @layer with no name creates a one-shot layer. Reopening it later creates a second anonymous layer with a different priority, which is rarely what authors intend.
  • DevTools support varies: Chrome and Edge show layer names next to rules in the Styles pane, but older Firefox builds and embedded WebViews still display layered rules without the layer label, making debugging harder.

In my experience, the trap that bites teams hardest is shipping a layered design system without a @supports fallback and finding out a week later that a chunk of iOS users on iOS 15.3 saw the page with zero component styling at all.

...

Citations

All CSS cascade layers version numbers and platform notes in this guide come from these primary sources:

Author

Prince Dewani is a Community Contributor at TestMu AI, where he manages content strategies around software testing, QA, and test automation. He is certified in Selenium, Cypress, Playwright, Appium, Automation Testing, and KaneAI. Prince has also presented academic research at the international conference PBCON-01. He further specializes in on-page SEO, bridging marketing with core testing technologies. On LinkedIn, he is followed by 4,300+ QA engineers, developers, DevOps experts, tech leaders, and AI-focused practitioners in the global testing community.

Open in ChatGPT Icon

Open in ChatGPT

Open in Claude Icon

Open in Claude

Open in Perplexity Icon

Open in Perplexity

Open in Grok Icon

Open in Grok

Open in Gemini AI Icon

Open in Gemini AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Frequently asked questions

Did you find this page helpful?

More Related Hubs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests