How do  - nth-child() and nth-of-type really work?

How do - nth-child() and nth-of-type really work?

I get this question a lot so I thought I'd make a quick video.

When you have a list of items, nth-child() and nth-of-type may not do exactly what you think they do.

Check this quick video for some clarity. Enjoy!

Find an issue with this post? Think you could clarify, update or add something?

All my posts are available to edit on Github. Any fix, little or small, is appreciated!

Edit on Github

Syntax Podcast

Hold on — I'm grabbin' the last one.

Listen Now →
Syntax Podcast

@wesbos Instant Grams

Master Gatsby

Master Gatsby

Building modern websites is tough. Preloading, routing, compression, critical CSS, caching, scaling and bundlers all make for blazing fast websites, but extra development and tooling get in the way.

Gatsby is a React.js framework that does it all for you. This course will teach you how to build your websites and let Gatsby take care of all the Hard Stuff™.
I post videos on and code on

Wes Bos © 1999 — 2022

Terms × Privacy Policy