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 trialTrent hand
7,402 PointsHaving some trouble with this code challenge.
The challenge is:
"Now, clear the left side of every 4th list item in the element with the id of "gallery". Here's a hint: You'll need to write another selector inside of the media query at the bottom of the file, in addition to the one you wrote in the previous step. You'll also need to use the nth-child pseudo selector."
AND MY CODE IS:
@media screen and (min-width: 480px) { #gallery li { width: 28.3333%; }
#gallery li:nth-child(4) { clear: left; } }
Am I missing something? I can't for the life of me figure this out :(.
5 Answers
Hazem mosaad
15,384 Points#gallery li:nth-child(4n) And not #gallery li:nth-child(4)
Trent hand
7,402 PointsThat worked! Do we always add "n" to the back of the number?
Hazem mosaad
15,384 Pointsyes to select the element you want 3n for the third one 2n for the second one !
Trent hand
7,402 PointsThank you Hazem. I'll remember that :).
Hazem mosaad
15,384 PointsYou Are Welcome :)
Ashby Bernardino
940 PointsAshby Bernardino
940 PointsHi Hazem,
Glad you answered this because I was stumped too.