Reputation:
I am not very pr in css How do i remove border-bottom from only the last li element in css.
ul li{
border-bottom: 1px solid blue;
}
Upvotes: 2
Views: 4835
Reputation: 15951
you can also use + Adjacent sibling for adding border
ul li+li {
border-top: 1px solid blue;
}
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
<li>four</li>
</ul>
Upvotes: 1
Reputation: 13
Use the following code:
ul li:last-child { border-bottom: none; }
Cheers :)
Upvotes: 1
Reputation:
Please go thru this link and see if this could help Remove right border off of the last Child div through CSS
Also
ul li:last-child {
border-bottom: none;
}
Upvotes: 0
Reputation: 99484
You could use :last-child
pseudo-class:
ul li:last-child {
border-bottom: 0;
}
This only works in IE9+. As a workaround, you could give top border to the list items and override the value for the :first-child
:
ul li {
border-top: 1px solid blue;
}
ul li:first-child {
border-top: 0;
}
Upvotes: 4