How to apply CSS only if there are a certain number of nested elements

· Gomakethings · Aug. 22, 2026, 4:40 p.m.
Summary
This blog post discusses a creative CSS technique for applying styles based on the number of nested elements in a list without using JavaScript, leveraging the :has() pseudo-class and other CSS selectors.