DEV Community

avcat
avcat

Posted on

:has(<n number of elements>)

Examples

An element contains at least 4 child elements

:has(:nth-child(4)) {...} 
Enter fullscreen mode Exit fullscreen mode

An element contains exactly 5 child elements

:has(:nth-child(5):last-child) {...} 
Enter fullscreen mode Exit fullscreen mode

Source.

Top comments (0)