第一个li

li:first-child {  background:#f00;  }

最后一个li

li:last-child {  background:#f00;  }

第n个li

li:nth-child(n) {  background:#f00;  }

倒数第二个li

nth-last-of-type(2) {  background:#f00;  }

奇数li

li:nth-child(odd) {  background:#f00;  }

偶数li

li:nth-child(even) {  background:#f00;  }