Beveled Lists with CSS3 :not(:nth-of-type)

A simple way to make beveled lists.

Check compatibility for those old, crumby browsers.

html and css

ul.beveled {
background-color: #efefef; /* any color darker than white */
list-style-type: none;
margin: 0;
}
ul.beveled li:not(:first-of-type) {
border-top: 1px solid rgba(255,255,255, 0.2;
}
ul.beveled li:not(:last-of-type) {
border-bottom: 1px solid rgba(0,0,0, .2);
}
<ul class="beveled">
<li>List item
<li>List item
<li>List item
<li>List item
</ul>

haml and sass

Let’s pretty that up with haml and sass (examples of both the scss and indented-sass syntax.)

ul.beveled
- 4.times do
li List item
ul.beveled
background-color: #efefef
list-style-type: none
margin: 0
padding: 10px
@include box-shadow( 0 2px 3px 0 rgba(0,0,0, .3)
li
padding: 10px 5px;
&:not(:first-of-type)
border-top: 1px solid rgba(255,255,255, 0.2)
&:not(:last-of-type)
border-bottom: 1px solid rgba(0,0,0, .2)
ul.beveled {
background-color: #efefef;
list-style-type: none;
margin: 0;
padding: 10px;
@include box-shadow( 0 2px 3px 0 rgba(0,0,0, .3);
li {
padding: 10px 5px;
&:not(:first-of-type) { border-top: 1px solid rgba(255,255,255, 0.2); }
&:not(:last-of-type) { border-bottom: 1px solid rgba(0,0,0, .2); }
} // li
} // ul.beveled