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 trialSamarth Shrivastav
Courses Plus Student 3,285 PointsBug 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
18,705 PointsHi 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!
Michael Afanasiev
Courses Plus Student 15,596 PointsHi Samarth,
You forgot to add an "n" after the 4. Check out the code below:
#gallery li:nth-child(4n) {
clear: left;
}
Michael Afanasiev
Courses Plus Student 15,596 PointsOops, answered too late :)
Samarth Shrivastav
Courses Plus Student 3,285 PointsGreetings! Mr. Michael!
I added some more information in the first answer's comments, please take note.
Thank You! Warm Regards, Samarth
Samarth Shrivastav
Courses Plus Student 3,285 PointsSamarth Shrivastav
Courses Plus Student 3,285 PointsGreetings! 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
Samarth Shrivastav
Courses Plus Student 3,285 PointsSamarth Shrivastav
Courses Plus Student 3,285 PointsP.S. I updated the last comment, please take note.
Ferdinand Pretorius
18,705 PointsFerdinand Pretorius
18,705 PointsPutting 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!
Michael Afanasiev
Courses Plus Student 15,596 PointsMichael Afanasiev
Courses Plus Student 15,596 PointsAnd to add to Ferdinand's comment here's a good documentation about nth-child pseudo-class
https://css-tricks.com/almanac/selectors/n/nth-child/
Samarth Shrivastav
Courses Plus Student 3,285 PointsSamarth Shrivastav
Courses Plus Student 3,285 PointsDo you prefer the W3C documentation? Or just any good one?
Ferdinand Pretorius
18,705 PointsFerdinand Pretorius
18,705 PointsYes, 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
Courses Plus Student 3,285 PointsSamarth Shrivastav
Courses Plus Student 3,285 PointsGreetings! 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
18,705 PointsFerdinand Pretorius
18,705 PointsYou'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
Courses Plus Student 3,285 PointsSamarth Shrivastav
Courses Plus Student 3,285 PointsHi 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?