Using CSS to “count” elements in a group

A List Apart has an article today about how you can use CSS selectors creatively to “count” the number of elements inside another element. This would be useful if, for instance, you wanted to style elements of a list differently when there’s more than six of them in the list.

Here’s the CodePen if you just want to see it in action.

Leave a Reply

Your email address will not be published. Required fields are marked *

*