That’s not a thing.

But it kinda is!

Bram covers how frustrating .bar:nth-child(2) is. It’s not “select the second element of class .bar.” It’s “select the second element if it also has the class .bar.” The good news? There is a real selector that does the former:

:nth-child(2 of .bar) { }

Safari only. Here are the tickets for Chrome and Firefox.

Direct Link to ArticlePermalink

The post CSS :nth-of-class selector appeared first on CSS-Tricks.