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

Code challenge-Help pleaseeeeeeeeeeeeeeee

I am having problem with code problems.Do you have any problems or instructions how to complete the code challenge problem? Suppose When I complete 1st objective of a code challenge,In the second task I am confused whether I should add code just after the 1st code or do it from scratch ? Many times I got this common message that it seems like that the task one is no longer passing? For example consider this problem- 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'."

li:first-child{ background-color: black; color:white; }
And it just worked fine.

Next, target the li that is the last child of the ul. Set its border to 'none'.

li: last-child { border : none; }

or this one ? li:last-child{ background-color: black; color:white; border: none; }

I am really confused and it showed me error all the time.I am also having similar type problem in other code challenge problem.Your help is highly appreciated.Thanks .Also Is there any other way to see the correct answer in code challenge?Thanks again.

5 Answers

the problem is not your code, the problem is that you cant delete the code from the first task.

This worked for me:

li:last-child{border: none;}

You have a space between li: and last-child{border:none;} in your post that might have caused it to fail.

However when I entered the following it worked just fine:

li:last-child{ background-color: black; color:white; border: none; }

Thanks so much .It just worked at last after too much painful waiting.Thanks again

You always ADD to the code that's already there. So task 2 builds on task 1 etc. That way, if you do something that has an effect on task 1 and you get it wrong or change task 1's answer, you fail.

BTW, this code seemed to require that everything was on the same horizontal line for some reason. Wouldn't work as separate lines. Also be sure to notice that the second question refers to the last child, so that makes a second line of code.