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

Jim McArthur
Jim McArthur
3,201 Points

Challenge task stump-er...

Q.- Inside the media query, clear the left side of every 4th list item in the gallery.

A. - #gallery li: nth-child (4n) { clear: left: }

"Bummer! did you set "clear: left" on every fourth gallery list item?

I have tried almost everything ......

5 Answers

Hi Jim,

Get rid of the space between li: and nth, and the space between child and (4). Also, get rid of the n after 4. One more thing, after left should be a semicolon not a colon.

Jeff

Hi Jeff,

It does pass with #gallery li:nth-child(4) but I believe this is an error in the challenge because that only clears the 4th item. Not every 4th list item like the instructions state.

#gallery li:nth-child(4n) also passes the challenge and I believe this to be the correct answer. This will select every 4th item.

There seems to be several(many?) expressions which will pass the challenge.

:nth-child(87n + 4) will pass the challenge. 87 was just a random big number I chose. n + 2 also passes.

I suspect it's checking that you've cleared the 4th item but not checking if you've incorrectly cleared other items.

Jim McArthur
Jim McArthur
3,201 Points

nope this following works on my "workspaces": But cant get by the "Challenge Task"

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

It may appear to work in your workspaces because the browser might be fixing this up for you but it's not the correct syntax.

You didn't get rid of both spaces as Jeff mentioned.

It should be:

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

Hi Jim,

Are you typing the code here or copy and pasting? Again, get rid of the space between li: and nth. Also, get rid of the n after 4.

Jeff

gallery li:nth-child(4n){

clear:left;

}