Skip to content

CSS Selectors



The :has(selector list) pseudo-class function matches an element if any of the selectors passed as parameter match at least one element.

The selector is currently not supported in Firefox.

Element with adjacent sibling

The selector :has(+ .item) matches all elements that have an adjacent sibling with the class item.

Element with child

The selector matches the .card element if it contains an input element that is invalid. In this example the input is required end therefore invalid if it is empty.

  • Fill out the input field to make it valid

Card with required input