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

Jesse Alair
Jesse Alair
4,675 Points

I can't get my code to pass on #gallery li:nth-child(4).

Hello my name is Jesse Alair and I'm having trouble getting a code challenge to pass. I am in the Web Design Track, inside the "How to Make a Website Course". I am doing the Code Challenge "Refactor the Layout" inside the Responsive Web Design and Testing section, Task #2. I'm pretty sure my code is right because I've checked it with my code from Workspaces that I've been following along with Nick Pettit. I can't find any bugs and can't seem to get it to pass no matter what I try.

The question reads, "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."

Here is my code:

@media screen and (min-width: 480px) {
  #gallery li {
    width: 28.3333%;
  }

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

2 Answers

pi R
pi R
12,720 Points

Hm, you can try with (4n) You can also test any of your attempts here : https://css-tricks.com/examples/nth-child-tester/#

Jesse Alair
Jesse Alair
4,675 Points

Thanks! That worked!

I can finally continue!

i still don't get this im going to the website I saw but, I don't get this at all. I need help.

What kind of problems are you having Enrique?