> All in One 586: CSS :nth-of-class selector

Ads

Monday, March 23, 2020

CSS :nth-of-class selector

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.



from CSS-Tricks https://ift.tt/38S7BYR
via IFTTT

No comments:

Post a Comment

HTTP Archive 2025 Web Almanac

I love me some good web research reports. I’m a sucker for them. HTTP Archive’s Web Almanac is one report I look forward to every year, and...