Hommer Smith Hommer Smith - 1 year ago 71
CSS Question

Remove top border of first child and bottom border of last child in CSS

I have the following HTML:


And the following CSS:

border-top:1px solid #FFF;
border-bottom: 1px solid #D0D0D0;

How can I remove the top border for the first LI element, and the bottom border for the last LI element?

Answer Source
li:first-child {
  border-top: none;
li:last-child {
  border-bottom: none;

Just like that.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download