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
Shuddha Chowdhury
3,817 PointsStrange code problem error
In the CSS Selectors badge there is a code challenge and the 1st task said to do this task
> "Select the li that is the first child of the ul. Set the color to 'white' and background color to 'black'."
Here is the code for it -
li:first-child{
background-color: black;
color:white;
border: none;
}
And in the second task it said
> Next, target the li that is the last child of the ul. Set its border to 'none'.
Here is the code
/* Complete the challenge by writing CSS below */
li:last-child{
background-color: black;
color:white;
border: none;
}
But it did not accept it and said ! It looks like Task 1 is no longer passing. Why is that? I am confident that my code is correct but why is that problem? Can anyone help please? Thanks
7 Answers
James Barnett
39,199 PointsWhen doing code challenges make sure to follow the directions closely. In task 1 the direction make no mention of removing a border and in task 2 the directions don't mention changing any colors.
Shuddha Chowdhury
3,817 PointsSorry for the small mistake in code for the above post.Yes I followed the instruction closely and the 1st code should be :
li:first-child{
background-color: black;
color:white;
}
And it just worked fine.In the second code it should be :
li: last-child {
border : none;
}
But it didn't work again and show the message : It looks like Task 1 is no longer passing. Why is that? I followed the instruction I guess.Help please
James Barnett
39,199 PointsSpaces in CSS selectors are syntactically significant, they refer to descendant selectors. I'm not sure if that's a typo or not.
Shuddha Chowdhury
3,817 PointsAnd according to my logic it must be the code and that should work fine.
Shuddha Chowdhury
3,817 PointsNo that is not for typo.Just removed the space and it still didn't work
James Barnett
39,199 PointsSo what do you have so far?
Shuddha Chowdhury
3,817 PointsThe 1st objective was perfect but couldn't solve the 2nd one anyhow?I just don't know what to do to get it correct.
Cyrus Ghazanfar
4,549 PointsI have the same problem. Same codes as Shuddha and on the 2nd objective it gives me "Oops! It looks like Task 1 is no longer passing."
James Barnett
39,199 PointsCyrus Ghazanfar - Remember it's your issue, your code, your thread. Without seeing your code we are just as lost as you are.
Cyrus Ghazanfar
4,549 PointsHello James, As i said in my previous comment, I have the same exact code as Shuddha. li:last-child{ background-color: black; color:white; border: none; }
morgan nokringer
3,576 Pointsli:first-child { color:white; background-color:black; }
li:last-child { border:none; }
it works