Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Foundations Advanced Selectors Pseudo-Classes: :nth-of-type and :only-of-type

Paul Trimor
Paul Trimor
5,388 Points

What is the difference between "nth-child" and "nth-of-type" ?

I noticed that even if there are other elements listed on a list, "nth-child" still specifies what type of element you are selecting, therefore will not count the elements you are not selecting- just like "nth-of-type".

1 Answer

Aldo Merino
Aldo Merino
6,066 Points

I was about to put an example but i found out a good page that explain it: http://css-tricks.com/the-difference-between-nth-child-and-nth-of-type/

Hi Aldo,

Good article.

Jeff