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

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

Samarth Shrivastav
PLUS
Samarth Shrivastav
Courses Plus Student 3,285 Points

Bug In Code Challenge

There is a bug in this code challenge, the correct answer is not being accepted.

Here's a screenshot of the page: https://plus.google.com/100996303071825809110/posts/ePkBHgVCTpX

In Task No. 2 the correct answer is not being accepted and the same code is being told to insert.

It was said that if we find a bug then contact support directly, but then the support told me to post it here, so here it is.

Have A Nice Day! Wish You Greater And Greater Health! Thank You! Regards, Samarth

2 Answers

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

Hi Samarth,

You were so close, your argument should have 4n inside of it. Like this:

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

  #gallery li:nth-child(4n){   /* Note the 'n' in the argument */
    clear: left;
  }
}

Keep up the good work though!

Samarth Shrivastav
Samarth Shrivastav
Courses Plus Student 3,285 Points

Greetings! Mr. Ferdinand!

I have tried it without the "n" in the Treehouse Workspaces and also in real life projects, and it works absolutely correctly. I have never used the "n" in the pseudo selector. And also, the code challenge shows a different error if the correct element is not being selected.

Why isn't it accepting it then?

Thank You! Best Regards, Samarth

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

Putting the 'n' in, is just good practise. Unfortunately for the challenge, that is just the way the test was written, you'll find a few of these, where an answered could be considered true, but is not accepted. I tend to look at the documentation, which will usually show different ways of accomplishing the same thing, and then try those 'methods' in the challenges.

Treat the challenges like an open book test, that's how I see it anyways.

Have a nice day!

Samarth Shrivastav
Samarth Shrivastav
Courses Plus Student 3,285 Points

Do you prefer the W3C documentation? Or just any good one?

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

Yes, I always try to get my answers/solutions from official documentation. That way, I know I am always implementing the latests changes. Though I do also use the site Michael has posted( css-tricks.com ) for css.

Samarth Shrivastav
Samarth Shrivastav
Courses Plus Student 3,285 Points

Greetings! Gentlemen!

Thanks For The Help Gentlemen! So I Have seen that both of them work in real life projects, with the "n" and without the "n" so guess the code challenge should accept it too. It's okay for it to be a good practice to insert the "n" in there, but when it works without it the code challenge should accept it too.

Thanks For Your Help Gentlemen! Have A Brilliant Day! Wish You Greater And Greater Health!

Thank You! Warm Regards, Samarth

Ferdinand Pretorius
Ferdinand Pretorius
18,705 Points

You're very welcome, best of luck on your programming endeavours, don't forget to vote up answers if they have been useful to you :)

Kind regards.

Samarth Shrivastav
Samarth Shrivastav
Courses Plus Student 3,285 Points

Hi There! I'm actually not marking any of these two answers as best because both of you guys answered it and the're both the same, just answered at different times, what should I do?

Michael Afanasiev
PLUS
Michael Afanasiev
Courses Plus Student 15,596 Points

Hi Samarth,

You forgot to add an "n" after the 4. Check out the code below:

 #gallery li:nth-child(4n) {
    clear: left;
  }
Samarth Shrivastav
Samarth Shrivastav
Courses Plus Student 3,285 Points

Greetings! Mr. Michael!

I added some more information in the first answer's comments, please take note.

Thank You! Warm Regards, Samarth