CSS :has()

div:has(a)

Lorem ipsum, dolor sit, amet consectetur adipisicing elit.
Lorem ipsum, dolor sit, amet consectetur adipisicing elit.

ul:has(li:nth-child(3))

.foo:has(.bar)

foo
foo bar

https://developer.mozilla.org/en-US/docs/Web/CSS/:has

caniemail.com, 2021.