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 trialAdam Yuen
Courses Plus Student 1,043 PointsNext, 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
Courses Plus Student 11,734 PointsHi 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
Adam Yuen
Courses Plus Student 1,043 PointsHey John,
I just tried the line but unfortunately no success. Still trying to figure out this problem.
John Steer-Fowler
Courses Plus Student 11,734 PointsFor 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
20,407 PointsAre 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; }
Adam Yuen
Courses Plus Student 1,043 Pointsno classes linked to it.
Adam Yuen
Courses Plus Student 1,043 Points@john, thanks I just reposted the problem again.
Joseph Wasden
20,407 PointsTry this
ul li:last-child{border:none}
Joseph Wasden
20,407 PointsI just retried the challenge and the above code worked for me. Hope that helps.
Adam Yuen
Courses Plus Student 1,043 Pointsit 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; }
Adam Yuen
Courses Plus Student 1,043 PointsJoseph Wasden - I tried that earlier and just tried it again. no bueno(no good)
Joseph Wasden
20,407 PointsHmmm...
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?
Daniel Muvdi
5,262 Pointsthe problem is not your code, the problem is that you cant delete the code from the first task.