.card:has(img) Select cards containing images
Style invalid inputs with :has()
.container:has(:empty) Empty container styles
h2:has(+ p) Select heading followed by paragraph
The :has() is a CSS Level 4 pseudo-class selector that allows selecting a parent element based on its children. It's often called the 'parent selector'.
:has() is supported by Chrome 105+, Safari 15.4+, Firefox 121+, Edge 105+. Global support exceeds 92%.
Styling parent based on children, form validation, empty states, previous sibling selection, and responsive layout adjustments.