:where() :is() :has()? New CSS selectors that make your life easier

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

A deep dive into three modern CSS pseudo-classes: :is(), :where(), and :has(). :is() reduces selector duplication and introduces a forgiving selector list that ignores invalid selectors. :where() works identically but always resolves to zero specificity, making it ideal for CSS libraries and resets. :has() — the long-awaited parent/relational selector — lets you style elements based on their descendants or siblings, enabling patterns like conditional form styling, toggling visibility without JavaScript, and more. The article covers browser support, specificity behavior, gotchas, and practical use cases for each.

17m read timeFrom polypane.app
Post cover image
Table of contents
A bit of historyChecking for support for :is()The :is() pseudo-classThe :where() pseudo-classThe :has() pseudo-class: the parent selector.The future for CSS selectors
31 Impressions