Workflow Beginner

Nesting selectors without Sass or Less

Selector nesting was the #1 reason people reached for Sass. It's now built into CSS. Same & syntax, zero build tools.

Modern
Plain .css
1/* nav.css, plain CSS, no compiler */
2.nav {
3  display: flex;
4  gap: 8px;
5
6  & a {
7    color: #888;
8    text-decoration: none;
9
10    &:hover {
11      color: white;
12    }
13  }
14}
Old Sass / .scss
1// nav.scss, requires Sass compiler
2.nav {
3  display: flex;
4  gap: 8px;
5
6  & a {
7    color: #888;
8    text-decoration: none;
9
10    &:hover {
11      color: white;
12    }
13  }
14}
15// sass --watch nav.scss nav.css
Newly available Since 2024 91% global usage

Since 2024 this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

120+
117+
17.2+
120+
this nav is styled with native CSS nesting
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more
⚑

No build step

Drop Sass, Less, PostCSS, or any compiler. Ship CSS directly to the browser, nesting included.

✦

Familiar syntax

Same & nesting you already know from Sass. Near-zero learning curve for existing teams.

∞

Smaller toolchain

One fewer dependency in your build. Faster installs, simpler CI, fewer things to break.

Dependency Removed
Sass / Less
Build tool eliminated
Old Approach
.scss β†’ .css
Compile step required
Modern Approach
.css β†’ .css
Ship as-is

How it works

CSS nesting lets you write child selectors inside parent rule blocks using the & symbol, just like Sass. The browser interprets .nav { & a { Ò€¦ } } as .nav a { Ò€¦ }.

You can nest pseudo-classes (&:hover), pseudo-elements (&::before), and even media/container queries inside a rule block. The & always refers to the parent selector.

Unlike the initial release, the relaxed nesting syntax now matches Sass: you can write bare element selectors like a { color: red } directly inside a parent. The & is only required for compound selectors like &:hover or &.active.

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC