Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- :nth-child 8:00
- :nth-of-type 4:30
- :nth Pseudo-Class Challenge 2 objectives
- :nth Pseudo-Class Challenge - Pt. 2 1 objective
- :root and :target 5:12
- :not() – The Negation Pseudo-Class 4:46
- Pseudo-Elements - ::first-line and ::first-letter 5:00
- Pseudo-Elements - ::before and ::after 8:13
- The attr() CSS Function 6:32
- Pseudo-Elements Challenge 4 objectives
- Advanced Selectors Review 6 questions

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
The :nth-of-type pseudo-class targets an element based on its position within a parent, but only if it’s a specific type of element.
Quick Reference
Using :nth-of-type
This selector targets the 4th div inside the parent, no matter what type of child elements come before it:
div:nth-of-type(4) {
background: #52bab3;
color: white;
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up