【发布时间】:2011-08-17 21:55:21
【问题描述】:
我为使用<li>s 构建的导航的第一个子项和最后一个子项设置了不同的背景图像。
我还想添加悬停图像。有什么办法可以将:first-child 和:hover 加在一起?
#nav li:first-child{
background:url(../images/topnavsprite.png);
background-position: 0px 0px;
}
#nav li:first-child:hover{
background:url(../images/topnavsprite.png);
background-position: 0px 0px;
}
提前致谢。
【问题讨论】:
-
你已经掌握了。如果您正在制作精灵以在悬停或第一个孩子上获得图像的正确部分,可能只需要调整您的背景位置。
标签: css hover css-selectors