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 trialWalker Reed
5,777 PointsStuck on Code Challenge
I can't figure out what I'm doing wrong here. The instructions say: "Inside the media query, clear the left side of every 4th list item in the gallery."
So, the I wrote this code (the media query code was supplied, and the width part was for the first part of the challenge):
@media screen and (min-width: 480px) {
#gallery li { width: 28.33333%; }
#gallery li:nth-child(4) { clear: left; }
}
It doesn't pass, and I can't figure it out...what am I doing wrong?
7 Answers
Walker Reed
5,777 PointsI tried (4n) which didn't work, but tried (4n+1) which did. I'm still not sure the technical difference.
Billy Jones
28,560 PointsWhen writing code you have to check your work and make sure it is accurate. Are you missing something in the id of gallery??? Check to see if you are missing a n after the 4. gallery li:nth-child(4n) {clear: left;}
Chase Lee
29,275 PointsTry just copying and pasting this:
@media screen and (min-width: 480px) {
#gallery li { width: 28.33333%; }
#gallery li:nth-child(4n) { clear: left; }
}
The 4n
should have worked. I must be something wrong with the server. Just keep submitting that answer.
Billy Jones
28,560 Pointsinteresting
Billy Jones
28,560 PointsThis is my first time doing this forum helping stuff. Does that mean i get the best answer and some extra points? just curious Chase James
Chase Lee
29,275 PointsThe best answer is selected by the author of the post, when he/she feels that they have been helped and well informed on their question, if at all.
If it were my post then, yes, I would give you "Best Answer". But in this case it's up to Walker Reed.
Is that what you were asking?
Walker Reed
5,777 PointsI do think there may be something wrong because I must have tried that 10 times. I think the confusion comes from the video that leads into this challenge just using li:nth-child(4). I still had my workspace open, so I was looking at the exact code that had been demonstrated for the track, but it wouldn't work in the challenge.
Billy Jones
28,560 Pointsyes. Thanks Chase James
Chase Lee
29,275 PointsYou're welcome!
P.S. If you get best answer you get 12 points!