Native CSS nesting is now supported across all modern browsers, offering a built-in alternative to Sass nesting. The post covers how the & selector works, key differences from Sass (no string concatenation for BEM, no mixins/variables), specificity rules (& behaves like :is() using highest specificity from parent list), and

10m read timeFrom alwaystwisted.com
Post cover image
Table of contents
What is CSS Nesting?Browser SupportHow Nesting Works in the BrowserSpecificity and CSS NestingCSS Nesting vs Sass NestingA Practical Example: Building a ComponentNesting with Container QueriesAccessibility: Reduced Motion PreferencesWhen to Nest and When Not ToCSS Nesting as Part of Modern CSS

Sort: