CSS nesting, a feature that allows you to nest one rule inside another, has long been a sought-after enhancement in the world of web development. This feature, which is now a part of the CSS Cascade Layers specification, promises to make our stylesheets more readable, maintainable, and DRY (Don't Repeat Yourself). But with great power comes great responsibility, and one of the first questions on every developer's mind is: what's the browser support like?
Understanding CSS Nesting
Before we dive into browser support, let's quickly understand what CSS nesting is and why it's a big deal. CSS nesting allows you to write styles that are nested within other styles, much like how you would structure your HTML. For instance, instead of writing:
.selector {
color: blue;
}
.selector .nested {
font-weight: bold;
}
You can now write:

.selector {
color: blue;
.nested {
font-weight: bold;
}
}
Browser Support: The Good News
The good news is that CSS nesting is already supported in all modern browsers, including Chrome, Firefox, Safari, and Edge. This means that you can start using it in your projects today without worrying about a significant portion of your users not being able to see your styles.
- Chrome: 89+
- Firefox: 74+
- Safari: 14+
- Edge: 89+
What About Internet Explorer?
As of now, Internet Explorer does not support CSS nesting. However, with the end of support for IE11 in June 2022, this might not be a significant concern for many projects. If you still need to support IE11, you can use tools like Autoprefixer or PostCSS to transpile your nested CSS into browser-compatible syntax.
Browser Support: The Not-So-Good News
While CSS nesting is supported in all modern browsers, there are a few caveats to be aware of. First, the syntax for nesting is not yet standardized. This means that the nesting syntax used in one browser might not work in another. For example, Chrome and Edge support the following syntax:

.selector {
color: blue;
.nested {
font-weight: bold;
}
}
However, Firefox requires a different syntax:
.selector {
color: blue;
& .nested {
font-weight: bold;
}
}
What About Nesting Within Nesting?
Another caveat is that nesting within nesting is not yet supported in any browser. This means that you can't nest a rule within another nested rule. For example, the following code will not work in any browser:
.selector {
color: blue;
.nested {
font-weight: bold;
.even-nested {
text-decoration: underline;
}
}
}
Instead, you'll need to use a different syntax, like this:

.selector {
color: blue;
}
.selector .nested {
font-weight: bold;
}
.selector .nested .even-nested {
text-decoration: underline;
}
Fallbacks and Progressive Enhancement
Given the current state of browser support, it's a good idea to use fallbacks and progressive enhancement techniques to ensure that your styles work in all browsers. You can use tools like Autoprefixer or PostCSS to transpile your nested CSS into browser-compatible syntax, or you can use CSS-in-JS libraries that handle browser compatibility for you.
Conclusion
CSS nesting is a powerful feature that can greatly improve the readability and maintainability of your stylesheets. While there are a few caveats to be aware of, especially regarding browser support, these issues are not insurmountable. With the right tools and techniques, you can start using CSS nesting in your projects today, safe in the knowledge that your styles will work in all modern browsers.






















