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 trialTushar Singh
Courses Plus Student 8,692 Pointsli:last-child
I have my borders on list items in navigation and wanna remove the border from the last item. When I use the last child pseudo class, it just removes all the borders. codepen--my css is not good.
nav ul li {
display:inline-block;
padding:20px;
border-right:1px solid white;
}
nav ul li:last-child {
border:none;
}
2 Answers
Matthew Ellis
12,303 PointsHi Tushar,
Looking at your Codepen, it looks like you have your <a> tags outside of your <li> tags.
ie.<a href=#><li>HOME</li></a>
Try:
<li><a href=#>HOME</a></li>
Steven Parker
231,269 PointsI was going to say you could apply last-child to the a
element instead, like this:
nav ul a:last-child li {
border: none;
}
And that works, but then there really shouldn't be any direct children of a ul
other than li
's. So go with Matthew's suggestion.
BTW, are you getting a little behind in choosing "best answer"s for your previous questions?
Tushar Singh
Courses Plus Student 8,692 PointsWell you din't solve my that problem . Nobody has an answer for me regarding that game . Only you can do this , Please help me . I am literally stuck and don't know what to do
Tushar Singh
Courses Plus Student 8,692 PointsTushar Singh
Courses Plus Student 8,692 PointsThanks