Home › Forums › CSS › nth-of-type ignores classes › Re: nth-of-type ignores classes
December 14, 2011 at 3:58 pm
#92753
Keymaster
It’s weird but I’m pretty sure this is the standard expected behavior. :nth-of-type doesn’t care about class, it cares about type.
a.foo:nth-of-type(odd)
So when this selector is evaluated, it first evaluates the :nth-of-type rule (it’s the right-most) and determines it’s looking for elements with type “a”. Then it finds the odd ones. Then if the odd one has a class of “foo”, it matches. So it’s still operating from it’s original match on all “a”, not “a”‘s limited to .foo.