CSS :has() Examples

Select an element based on the number of children it has.

In this example we change the style of any card with 4 or more elements.

.card:has(> *:nth-child(4n)) {
  background: #FF474E;
}
one
one
two
one
two
three
one
two
three
four
one
two
three
four
five