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

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

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

li:last-child{ border: none; }

this isnt working

8 Answers

John Steer-Fowler
PLUS
John Steer-Fowler
Courses Plus Student 11,734 Points

Hi Adam,

I think this is the correct answer off the top of my head. I think this syntax say's target <li> that is the last child of the <ul>

li:last-child ul {
   border: none;
}

Hope this helps, but it might be wrong

Hey John,

I just tried the line but unfortunately no success. Still trying to figure out this problem.

John Steer-Fowler
John Steer-Fowler
Courses Plus Student 11,734 Points

For future, you can make a forum post directly from the Code Challenge you are stuck on. Then people can have a go on the same challenge to help find an answer :D

Joseph Wasden
Joseph Wasden
20,406 Points

Are there any attributes (such as a class) assigned to the li that you could use to target the element? Try the below, if possible.

```li[class="theclass"]:last-child { border: none; }

no classes linked to it.

@john, thanks I just reposted the problem again.

Joseph Wasden
Joseph Wasden
20,406 Points

Try this

ul li:last-child{border:none}

Joseph Wasden
Joseph Wasden
20,406 Points

I just retried the challenge and the above code worked for me. Hope that helps.

it says Oops! It looks like Task 1 is no longer passing.

my code so far ul li:last-child{ color:white; background:black; border:none; }

Joseph Wasden - I tried that earlier and just tried it again. no bueno(no good)

Joseph Wasden
Joseph Wasden
20,406 Points

Hmmm...

Sorry it wasn't a help. I'm very curious what the problem could be.

to be clear, you should have two rules in the CSS at this point, both the first-child and the last-child. can you copy and paste the full CSS from your challenge here?

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