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 trialLearning coding
Front End Web Development Techdegree Student 9,937 PointsWhy doesn't the 4child element get the #52bab3; background with white letters?
At 1.30 in the video the 4th child (a new heading) is targeted. Although the h1 isn't a div child, it's also a child of section. So it confuses a bit, why don't the background change to #52bab3; and the letters into white?
2 Answers
Steven Parker
231,248 PointsCongratulations on resolving your own issue.
Yes, that's the difference between :nth-child and :nth-of-type.
Changjoon Song
Python Web Development Techdegree Student 8,092 PointsI have a similar question. Why didn't it target the h1 element when before switching over to "type". Does this mean, if h1 had been within <div>, it would be targeted?
Learning coding
Front End Web Development Techdegree Student 9,937 PointsLearning coding
Front End Web Development Techdegree Student 9,937 PointsOh i understand, it has to be the same type of child.