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 trialKerry Hinkle, Jr
830 PointsNth-child Selector
In the challenge I'm being asked:
Clear the left side of every 4th list item in the element with the id of "gallery". 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.
Attached is the code the challenge is telling me is incorrect. Please help!!!!
@media screen and (min-width: 480px) {
#gallery li {
width: 28.3333%;
}
#gallery li: nth-child (4n) {
clear: left;
}
}
3 Answers
Krzysztof Kucharzyk
Front End Web Development Techdegree Student 4,005 PointsYour code looks good besides this lil space between li:
and nth-child(4n)
#gallery li: nth-child (4n) { /* remove space between li: and nth-child(4n) */
clear: left;
}
#gallery li:nth-child (4n) {
clear: left;
}
Kristopher Van Sant
Courses Plus Student 18,830 PointsHi! In addition to what Krzysztof Kucharzyk said, you also need to remove the white space between nth-child and (4n)
#gallery li:nth-child(4n) {
clear: left;
}
Kerry Hinkle, Jr
830 PointsTHANK YOU BOTH! Finally got it! Lol
Kerry Hinkle, Jr
830 PointsKerry Hinkle, Jr
830 PointsThe challenge is still saying I did it incorrectly. I contacted the support team. May be a programming issue or something. Thanks!!!