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 trial

CSS How to Make a Website Responsive Web Design and Testing Refactor the Layout

Maren Linkugel
Maren Linkugel
5,220 Points

nth-child question

I can't seem to figure out this task in the Responsive Web Design quiz:

Challenge task 2 of 2 Inside the media query, clear the left side of every 4th list item in the gallery.

I tried these but they are not working. Ideas?

gallery li: nth-child (4n) {

clear: left;


and also I tried:

gallery li: nth-child (3n+1) {

clear: left;


4 Answers

Hi Maren,

It's expecting the 1st one given that it says to clear every 4th item.

The only problem you have is that you need to remove the space after : and the space after nth-child

Should be #gallery li:nth-child(4n) {

Is gallery an id or a class name perhaps?

I believe

#gallery li:nth-child(4n+4) {
    clear: left;

should work. In nth-child, the first number is the starting point, and the second number is the skip value.

jase richards
jase richards
10,379 Points
  yeah, your code is missing the hash '#' to call the gallery.