8 CSS :has() Patterns You'll Actually Use (2026)
CSS :has() is production-ready in every browser. Here are 8 real-world patterns: form states, sibling dimming, modal scroll-lock, and more.
2 articles
Modern CSS with an emphasis on features that changed what is possible without JavaScript. This section covers practical patterns for the :has() selector, the parent-selection problems it finally solves, and a migration from shadcn and Radix positioning to native CSS anchor positioning. Browser support caveats are stated explicitly, including which behaviour degrades and how, because a CSS feature that works in one engine and silently no-ops in another is a production issue rather than a footnote.
CSS :has() is production-ready in every browser. Here are 8 real-world patterns: form states, sibling dimming, modal scroll-lock, and more.
How to migrate shadcn/ui Popover and Tooltip from Radix UI to native CSS Anchor Positioning and the Popover API, with real before/after code.