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 trialNico Dyll
2,472 PointsWhy is this code: #gallery li:nth child(4n){ clear: left; } not the correct answer for the challenge
I'm not sure why this isn't getting the correct answer on the code challenge.
2 Answers
Jeremy Hogan
15,451 Points(copying from comment to answer. Thanks, Jeff) That's the correct code (except there should be a dash between nth and child). However, when I put that myself in the code challenge, it didn't validate. It took me a moment to notice that the brackets were messed up by their code editor. It usually automatically adds a closing bracket when you open one, but that doesn't happen within media queries, so you were probably missing some closing brackets.
It should look like this when you're done.
@media screen and (min-width: 480px) {
#gallery li {
width:28.3333%;
} /* close it */
#gallery li:nth-child(4n) {
clear:left;
} /* close it */
} /* close the media query */
Jeff Lemay
14,268 Pointsanswered in comments
Jeremy Hogan
15,451 PointsJeremy Hogan
15,451 PointsThat's the correct code (except there should be a dash between nth and child). However, when I put that myself in the code challenge, it didn't validate. It took me a moment to notice that the brackets were messed up by their code editor. It usually automatically adds a closing bracket when you open one, but that doesn't happen within media queries, so you were probably missing some closing brackets.
It should look like this when you're done.