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 trialXavier Duncan
Full Stack JavaScript Techdegree Student 6,138 PointsProblems with Media Query code challenge. Help?
I cannot pass the second part in the "Responsive Web Design and Testing" code challenge, just a simple media query...
Challenge 1: Inside the media query, select the list items inside the gallery and add a width of 28.3333%.
Passed, here's my code:
@media screen and (min-width: 480px) {
#gallery li {
width: 28.3333%;
}
}
Challenge 2: Inside the media query, clear the left side of every 4th list item in gallery.
Failed, here's my code:
@media screen and (min-width: 480px) {
#gallery li {
width: 28.3333%;
}
#gallery li:nth-child (4n) {
clear: left;
}
}
I even pasted the same code used for the practice site we're building (which worked perfectly fine) and still no go. Am I missing something?
3 Answers
Chris Shaw
26,676 PointsHi Xavier,
Very simple issue and it's a very common one too, you have a space after nth-child
which can't be there as browsers won't parse it.
#gallery li:nth-child(4n) {
clear: left;
}
Nurul Ahsan
2,039 Points'Inside the media query, select the list items inside the gallery and add a width of 28.3333%."
@media screen and (min-width:480px){
#gallery li{
max-width: 28.3333%;
}
}
Nurul Ahsan
2,039 PointsNurul Ahsan 809 6 days ago
'Inside the media query, select the list items inside the gallery and add a width of 28.3333%."
@media screen and (min-width:480px){ #gallery li{ max-width: 28.3333%;
}
}
Xavier Duncan
Full Stack JavaScript Techdegree Student 6,138 PointsXavier Duncan
Full Stack JavaScript Techdegree Student 6,138 PointsWow, good to know. Thanks!