CSS :has() Examples

Select an element above or before a given element.

div:has(+ .target) {
  color: black;
  background: #fabf46;
}

Select Me!

The previous div is selected by selecting this div.