CSS 3 · Selectors and the box model

Select a parent by its children

Style a card that contains an image.

.card:has(img) {
  padding: 0;
}

Official CSS 3 documentation

More selectors and the box model commands

All selectors and the box model commands · CSS 3 cheatsheet

Was this page helpful?