Using :has() as a CSS Parent Selector and much more
The CSS `:has()` pseudo-class, long requested as a "parent selector", lets developers style an element based on its descendants, its following siblings, or the state of elements anywhere in the DOM. WebKit shipped it in Safari 15.4 using new `:has`-specific caching and filtering optimizations. Chrome 105 ships Igalia's implementation, and Firefox is in progress. Hands-on examples cover styling figures and grid cards by their content, the child and sibling combinators inside `:has()`, form-state styling such as `:focus-visible` and `:invalid` labels, and JavaScript-free theme toggles. Some pseudo-classes, including media states and certain form invalidation cases, don't yet update inside `:has()`, so cross-browser testing is recommended.
Related posts
- WebKit Features in Safari 16.5
WebKit easyNoviceSafari 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.
- Try out CSS Nesting today
WebKit mediumAdeptCSS 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.
- New to the web platform in July
web.dev easyNoviceChrome 151, Firefox 153 and Safari 26.6 reached stable in July 2026. Firefox relaxes HTML parsing inside <select> to prepare for customizable selects, and adds desktop Picture-in-Picture, the Intl.Locale info getters (now Baseline Newly available) and IndexedDB getAllRecords(). Chrome adds the ruby-overhang CSS property, declarative manual slot assignment via shadowrootslotassignment, an animation attribute on AnimationEvent/TransitionEvent, textStream() on Response/Request/Blob, and the <usermedia> permission element, while Safari ships CSS and cookie bug fixes. Betas preview Chrome 152, Firefox 154 WebRTC transport APIs and a large Safari 27 CSS and accessibility feature set.
- New to the web platform in August
web.dev easyNoviceChrome 152 and Firefox 154 shipped to stable in August 2026, making several features Baseline Newly available: the text-box-trim/text-box-edge properties for trimming font leading, the sibling-count() and sibling-index() CSS functions, and the global autocorrect attribute. Chrome 152 also adds the CSS Color 5 alpha() function, the standardized window-drag property replacing app-region, OpaqueRange for range APIs over form-control text, and CSSPseudoElement support for ::backdrop, ::scroll-marker and ::view-transition. Firefox 154 adds Iterator helpers (includes, join, chunks, windows) and WebRTC transport APIs such as getSelectedCandidatePair(). The Chrome 153 and Firefox 155 betas preview single-axis scroll containers, Iterator zip, <camera>/<microphone> elements, and URL properties on SVG <a> elements.
- News from WWDC26: WebKit in Safari 27 beta
WebKit mediumAdeptSafari 27 beta ships 58 new features, 525 fixes and 4 deprecations, with most of the work going into correctness, edge cases, cross-feature interactions and alignment with web standards and other browsers. Headline features include customizable <select> via appearance: base-select with ::picker-icon, ::checkmark and <selectedcontent>, transform-aware anchor positioning, scroll anchoring, WebAssembly JSPI, the :heading pseudo-class, revert-rule, the stretch sizing keyword and subpixel inline layout. Anchor positioning also changes: position-anchor now defaults to normal, and anchors-valid/anchors-visible are renamed to anchor-valid/anchor-visible. Long lists of fixes cover CSS layout, :has() invalidation performance, SVG 2 alignment, tables and form controls.