CSS :has() is the parent selector we’ve always wanted 🎯
Target elements based on what they contain, not just their own state.
⋅ Style a form when it has an error input
⋅ Add spacing to any element with children
⋅ Combine with :not()
Learn more 👇
https://developer.mozilla.org/en-US/docs/Web/CSS/:has
MDN Web Docs
@mdn@mastodon.social
The official MDN Web Docs account. We deliver the best web docs around. Visit → https://mdn.dev Contribute → https://mdn.dev/community
mastodon.social
MDN Web Docs
@mdn@mastodon.social
The official MDN Web Docs account. We deliver the best web docs around. Visit → https://mdn.dev Contribute → https://mdn.dev/community
mastodon.social
@mdn@mastodon.social
·
Mar 07, 2026
9
0
6
Loading comments...