答案 0 :(得分:2)
您似乎对类和伪选择器感到困惑,伪选择器:first-child
不等同于到.first
(类名)。同样,:last-child
不等同于.last
(同样是类名)。
使用:
.bodyheader ul li:first-child a:hover { background-position: 0 -16px; }
.bodyheader ul li:last-child { background: none; margin-right: 0; padding-right: 0; }
参考文献:
答案 1 :(得分:1)
使用:first-child
和:last-child
代替.first
和.last
.whatever
引用包含class="whatever"
的元素,而:first-child
和:last-child
是伪选择符,因为您已使用:hover
链接