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
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.

APA
MLA
avcat | Sciencx (2025-08-20T11:40:58+00:00) :has(<n number of elements>). Retrieved from https://www.scien.cx/2025/08/20/hasn-number-of-elements/
" » :has(<n number of elements>)." avcat | Sciencx - Wednesday August 20, 2025, https://www.scien.cx/2025/08/20/hasn-number-of-elements/
HARVARDavcat | Sciencx Wednesday August 20, 2025 » :has(<n number of elements>)., viewed ,<https://www.scien.cx/2025/08/20/hasn-number-of-elements/>
VANCOUVERavcat | Sciencx - » :has(<n number of elements>). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/08/20/hasn-number-of-elements/
CHICAGO" » :has(<n number of elements>)." avcat | Sciencx - Accessed . https://www.scien.cx/2025/08/20/hasn-number-of-elements/
IEEE" » :has(<n number of elements>)." avcat | Sciencx [Online]. Available: https://www.scien.cx/2025/08/20/hasn-number-of-elements/. [Accessed: ]
rf:citation » :has(<n number of elements>) | avcat | Sciencx | https://www.scien.cx/2025/08/20/hasn-number-of-elements/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.