For this particular site, when I utilize nth-child via CSS or jQuery, the ‘nth-child’ selector is capturing the wrong element. I’m getting one child before the selector that I’m calling:
.home article:nth-child(3) {} //captures 2nd child
This seems to be capturing the second child instead. If I attempt:
.home article:nth-child(1) {} //captures nothing
This captures no elements. In jQuery, it shows up as an empty array. Here’s the dev site that I’m working on. Thank you.
In your site, you have a clearfix
divthat’s the first child of its parent element within your container, so your firstarticleis really the second child, not the first:In CSS, you can use
:nth-of-type()instead to reach the thirdarticleelement:Oddly enough, jQuery does not support
:nth-of-type(), so for a cross-browser solution you have to opt with:eq()with a zero-based index: