It is very common for coders, the first-time they use the nth-child pseudo-class, to assume that :nth-child looks at the type, class and/or ID rather than simply the number of all children. Most have never heard of the :nth-of-type pseudo-class. You are in crowded company.
<off-topic:fyi-only>
The W3Schools company is not the same as the W3Consortium that writes the web standards. The names are conveniently similar, but there is no affiliation.
The W3C reference page for selectors is here: http://www.w3.org/TR/CSS2/selector.html. I use the W3Schools site occasionally, but not as an “authoritative” reference.