Glossary
:has() selector

:has() selector

The :has() selector is a CSS selector that styles an element based on its descendants or later siblings — for example, styling a form field's container only when it holds an invalid input, something no other selector could do without JavaScript.

It works in reverse from a descendant selector, which picks a child based on its parent. With :has(), you select the parent (or an earlier sibling) based on what's inside or after it. Browser support for :has() reached Baseline widely available status in June 2026.

Other glossary terms

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Hmm…we couldn’t find any results. Try a different search term or reset the filter.
Reset the filter
Load more