CSS Nesting lets you place style rules inside other rules. Learn the syntax, browser support across Chrome 112+, Firefox 117+, Safari 16.5+, and known issues.

Prince Dewani
May 6, 2026
CSS Nesting is a W3C CSS Nesting Module Level 1 feature that lets authors write one style rule inside another using the & nesting selector to reference the parent. It works in Chrome 112+, Edge 112+, Firefox 117+, Safari 16.5+ on macOS and iOS, Opera 98+, and Samsung Internet 23+, while Internet Explorer never added support.
This guide covers what CSS Nesting is, the browsers that support it, the syntax with examples, how to check support, and the known issues.
CSS Nesting is a W3C CSS Nesting Module Level 1 feature that lets authors write one style rule inside another, with child selectors resolved relative to the parent. The & nesting selector points to the outer rule explicitly. The browser parses nested rules natively, with no preprocessor build step required.
CSS Nesting works in every modern desktop browser and most mobile browsers, with Chrome and Edge shipping it first, Safari adding it in Safari 16.5, and Firefox following in Firefox 117. The relaxed grammar that lifts the leading-symbol restriction reached every major browser by Chrome 120, Safari 17.2, and Firefox 117.
Chrome supports CSS Nesting from Chrome 112 on Windows, macOS, Linux, ChromeOS, and Android. The relaxed grammar that allows nested type selectors without a leading & arrived in Chrome 120. Chrome 109 to 111 had CSS Nesting disabled by default behind the experimental Web Platform features flag; Chrome 4 to 108 did not support CSS Nesting at all.
Microsoft Edge supports CSS Nesting from Edge 112 on Windows, macOS, and Linux, and the relaxed grammar shipped in Edge 120. Edge 109 to 111 needed the experimental Web Platform features flag to use it. Edge 12 to 108 had no support, the same as Chrome since both share the Chromium engine.
Firefox supports CSS Nesting from Firefox 117 on Windows, macOS, Linux, and Android, and ships the relaxed grammar by default in the same release. Firefox 115 and 116 had CSS Nesting disabled by default behind the layout.css.nesting.enabled flag in about:config. Firefox 1 to 114 did not support the feature.
Safari supports CSS Nesting from Safari 16.5 on macOS Big Sur 11 and later, with iOS Safari and iPadOS Safari adding support in the matching Safari 16.5 release. The relaxed grammar that drops the leading-symbol restriction shipped in Safari 17.2 on macOS, iOS, and iPadOS. Safari 3.1 to 16.4 on macOS and iOS 3 to 16.4 on iPhone did not support CSS Nesting.
Opera supports CSS Nesting from Opera 98 on desktop, with the relaxed grammar arriving in Opera 106. Opera Mobile supports it from Opera Mobile 80 on Android. Opera 9 to 94 and Opera Mobile builds before 80 did not support the feature, since Opera tracks Chromium and inherited nesting only after the upstream feature stabilized.
Samsung Internet supports CSS Nesting from Samsung Internet 23 on Galaxy phones and tablets, with the relaxed grammar shipping in Samsung Internet 25. Samsung Internet 4 to 22 did not implement CSS Nesting, so older Galaxy devices that have not received a browser update fall back to flat CSS.
Chrome for Android supports CSS Nesting from Chrome for Android 112 on Android 8 and later, matching desktop Chrome. The legacy stock Android Browser does not implement CSS Nesting, so any old WebView build below Chromium 112 falls back to flat selectors. Firefox for Android supports it from Firefox 117 on Android.
Internet Explorer does not support CSS Nesting in any version. IE 5.5 to 11 predate the CSS Nesting Module Level 1 spec, and Microsoft has retired Internet Explorer in favor of Chromium Edge. Sites that still need IE support must precompile nested CSS with Sass, Less, or PostCSS into flat rules.
Note: CSS Nesting breaks across older Safari, Firefox, and Android WebView builds. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!
CSS Nesting wraps a child rule inside its parent rule, and the browser resolves the child selector relative to the parent. The & nesting selector points back to the outer rule and is required when the inner rule starts with a pseudo-class, a compound selector, or places the parent on the right side of a combinator.
The example below shows the same three rules written in flat CSS and in native CSS Nesting, plus a nested @media query. Both forms produce the same matched selectors at runtime.
/* Without nesting (flat CSS) */
.card { padding: 1rem; }
.card h2 { font-size: 1.25rem; }
.card:hover { border-color: blue; }
/* With native CSS Nesting */
.card {
padding: 1rem;
h2 {
font-size: 1.25rem;
}
&:hover {
border-color: blue;
}
@media (min-width: 768px) {
padding: 2rem;
}
}A few rules apply across every browser that ships CSS Nesting:
Run a quick CSS.supports probe in DevTools, or guard a rule with @supports selector(&) inside a stylesheet. Both paths return a clear yes or no without changing the page.
The console snippet below packages the probe and prints a one-line yes or no:
// Run in the browser DevTools Console
const supportsNesting = CSS.supports("selector(&)");
console.log("Native CSS Nesting:", supportsNesting ? "yes" : "no");
// Or guard a rule from inside a stylesheet:
// @supports selector(&) {
// .card { &:hover { border-color: blue; } }
// }If the probe returns false, fall back to a precompiled flat stylesheet built with PostCSS Nesting, Sass, or Less so the page still renders correctly.
CSS Nesting is now a W3C Baseline 2023 feature, but a handful of edge cases still trip up production sites. The biggest hits are the strict-versus-relaxed grammar split, specificity surprises, and older mobile browsers.
In my experience, the most surprising failure happens with the strict grammar in Chrome 112 to 119. A nested rule like h2 inside .card silently disappears from the cascade, the Elements panel shows the parent as if the inner rule never existed, and the only signal in DevTools is a quiet warning in the Issues tab. Pair every nested type selector with an & during that version window, or wrap the block in @supports selector(&) until you can drop those builds.
All CSS Nesting version numbers and platform notes in this guide come from these primary sources:
Did you find this page helpful?
More Related Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance