开发者社区 问答 正文

为什么hover会失效?

<div id="box">
    <a href=""></a>
</div>



css
#box a {
  width: 33px;
  height: 33px;
  display: block;
  background: url(../images/loginIcon.png) no-repeat 0 0;
}
#box a :hover {
  background-position: -31px -5px;
}

为什么鼠标移上去背景没有变?

展开
收起
a123456678 2016-05-27 17:07:45 1819 分享 版权
1 条回答
写回答
取消 提交回答
  • #box a:hover {
      background-position: -31px -5px;
    }

    a后面不能有空格。

    2019-07-17 19:18:21
    赞同 展开评论
问答分类:
问答地址: