Comparing the nth-child and nth-of-type pseudoclasses

nth-child and nth-of-type sound like the same thing, and in some situations, they can act the same way as well. Learn which pseudoclass is right for which situation, and never confuse the two again!

By Jen Kramer
May 26, 2016
Comparing nth-child and nth-of-type Comparing nth-child and nth-of-type

Learn the ins and outs of CSS with CSS: The Definitive Collection, a series of short and practical ebooks taken from the upcoming book CSS: The Definitive Guide, 4th Edition.

Learn faster. Dig deeper. See farther.

Join the O'Reilly online learning platform. Get a free trial today and find answers on the fly, or master something new and useful.

Learn more
Post topics: Web Programming