The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript using nth-child(1) on a anchor Re: using nth-child(1) on a anchor

Chris Coyier

I’ll bet you a nickel:

#home nav ul li:nth-child(1) a {

The CSS infers a list. It’s the list items which have multiple siblings within the list. The anchors are within the list items, so :nth-child see’s all of them as the first child of list items (the “counters” reset when you move down a DOM level).