
ul li:first-child a {
border-radius: 5px 5px 0 0;
}
ul li:last-child a {
border-radius: 0 0 5px 5px;
}
When there's just once child, the last-child style over-rides the first-child style. Is there a way to apply both (since it is both the first and last child)
Am looking to achieve this with just CSS, without the aid of JS. Thanks.
Just apply your borders individually:
That way the last-applied rule doesn't override the previous rule (
border-radius: 5px 5px 0 0;resets the bottom border radii back to zero).Demo: http://jsfiddle.net/vUz5Z/5/