This content originally appeared on DEV Community and was authored by avcat
Examples
An element contains at least 4 child elements
:has(:nth-child(4)) {...}
An element contains exactly 5 child elements
:has(:nth-child(5):last-child) {...}
This content originally appeared on DEV Community and was authored by avcat