.card {
border: 1px solid var(--rule);
& .title {
font-weight: 600;
}
&:hover {
border-color: var(--brand);
}
}
Almost identical to Sass syntax, on purpose
The working group deliberately designed native CSS nesting to feel familiar to the huge number of developers already writing nested Sass - the ampersand-for-parent-selector convention carried over directly.
So does this replace Sass?
For nesting specifically, largely yes, on projects targeting current browsers. Sass's variables have already been mostly superseded by CSS custom properties over the past few years too. What Sass still offers that native CSS doesn't: loops, real functions, and mixins with default arguments - genuinely useful on larger design systems, less necessary on a typical marketing site.
Our current default
New small projects: plain CSS with nesting and custom properties, no build step. Larger design-system-driven projects: Sass still earns its place, for now.
What used to require Sass now ships in the browser
.card {
padding: 20px;
& h3 { margin-top: 0; }
&:hover { box-shadow: var(--shadow-md); }
@media (min-width: 900px) { padding: 32px; }
}
Native nesting mirrors Sass's syntax closely enough that migrating existing preprocessor code is often a find-and-replace exercise, and it works with zero build step - the browser parses it directly.
One rule that's easy to trip on
Unlike Sass, native CSS nesting requires the nested selector to start with a combinator like & when it's not a plain descendant - writing h3 { ... } nested directly works for descendant selectors, but compound selectors like &.active need the ampersand explicitly. It's a small syntax detail that catches almost everyone coming from Sass on the first attempt.