Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

WebKit 3 min read Opinion mediumAdept

CSS Nesting and the Cascade

CSS Nesting now supports relaxed parsing, so nested selectors no longer need to start with a symbol: `h1 { }` inside `article { }` just works. Firefox 117 and Safari Technology Preview 179 ship it, and Chrome's update is in progress. The `&` still marks where the parent selector goes, as in `article &`. An open question remains about declarations that follow a nested `@supports` block. The current spec, matching Sass, Less and other preprocessors, hoists them so the earlier rule wins, while a developer survey favored preserving source order (62% vs 38%).

Related posts

  • Try out CSS Nesting today

    WebKit mediumAdept

    CSS Nesting, using the community-chosen Option 3 syntax, shipped on by default in Safari Technology Preview 162 and is behind a flag in Chrome Dev. It works much like Sass nesting, but in this version a nested selector must begin with a symbol: a bare element selector like `article` is silently ignored, which you avoid by prefixing `&` or wrapping it in `:is()`. The `&` also places the parent selector explicitly, as in `.component &` or `&:hover` without a descendant space. A later note says Safari Technology Preview 179+ dropped the symbol requirement.

  • Help choose the syntax for CSS Nesting

    WebKit mediumAdept

    The CSS Working Group is choosing between three candidate syntaxes for native CSS nesting, since Sass-style nesting is impossible: browser parsers would read a nested selector like `element:pseudo` as a `property: value` declaration. Option 3 lets nested rules sit directly in the declaration block but forbids them from starting with a letter, so element selectors need `&` or an `:is()` wrapper. Option 4 adds an optional second block after the declarations that holds only nested rules. Option 5 introduces a dedicated `@nest` at-rule. Side-by-side examples cover basics, nested nesting, media queries and cascade layers, and developers are asked to vote in a survey.

  • WebKit Features in Safari 16.5

    WebKit easyNovice

    Safari 16.5 is mainly a polish and bug-fix release that adds CSS Nesting, the :user-valid and :user-invalid pseudo-classes, Apple Pay support for pre-orders and deferred payments, and disabling of the WebCodecs API in Lockdown Mode. Nesting still requires nested element selectors to start with a symbol such as &, a limitation the CSS Working Group hopes to remove. The new form pseudo-classes wait for user interaction before flagging input as invalid, which removes the need for JavaScript workarounds, and they pair well with :has(). Dozens of fixes cover CSS margin-trim, scroll snapping, media playback, WASM SIMD and Web Inspector.

  • Release Notes for Safari Technology Preview 243

    WebKit mediumAdept

    Safari Technology Preview 243 ships WebKit changes 310600@main through 312007@main for macOS Tahoe and Sequoia. The bulk of the release is CSS layout and selector fixes, covering flexbox, grid, aspect-ratio, anchor positioning, `:has()` invalidation and CJK line breaking. It also adds `contain: style` for quote counters, the `insert` keyword for `text-autospace` and the `shadowrootslotassignment` attribute. Other changes include accessibility fixes for VoiceOver, an O(n²) fix for parsing large `<select>` lists, an ES module loader rewrite for top-level await correctness, and several regular expression fixes.

  • WebKit Features in Safari 17.2

    WebKit mediumAdept

    Safari 17.2 ships 39 web platform features and 169 fixes, its largest December release. HTML gains exclusive accordions via the `name` attribute on `<details>`. CSS gains relaxed nesting without `&`, the root font units rcap/rex/ric/rch plus `cap`, completed Motion Path support with `rect()`/`xywh()` shapes, `linear()` easing, mixed percentage and length arguments in `round()`/`mod()`/`rem()`, `counter-set`, unprefixed `mask-border`, and the Custom Highlights API. JavaScript and web APIs add import attributes for JSON modules, `Intl.NumberFormat` approximate ranges, Fetch Priority, responsive image preloading, and H264 L1T2 in WebCodecs, with short code examples for many of them.

The quest for software engineering knowledge.

Look:
Layout: