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

Strange code problem error

In the CSS Selectors badge there is a code challenge and the 1st task said to do this task

http://teamtreehouse.com/library/websites/css-foundations-2/selectors-reshoot/basic-structural-pseudoclasses-2

> "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

When 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.

Sorry 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

Spaces in CSS selectors are syntactically significant, they refer to descendant selectors. I'm not sure if that's a typo or not.

And according to my logic it must be the code and that should work fine.

No that is not for typo.Just removed the space and it still didn't work

So what do you have so far?

The 1st objective was perfect but couldn't solve the 2nd one anyhow?I just don't know what to do to get it correct.

I 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."

Cyrus Ghazanfar - Remember it's your issue, your code, your thread. Without seeing your code we are just as lost as you are.

Hello 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; }

li:first-child { color:white; background-color:black; }

li:last-child { border:none; }

it works