CSS 活动在 IE9 中不执行鼠标释放



当我在IE9中按下鼠标时,图像会保持原位。我必须单击页面的其他部分才能将其恢复。Firefox和Chrome工作正常(他们放回了原始图像(。有什么想法吗?

如果我使用 IE9,它甚至可以在这里工作http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro

但是,如果我在桌面上创建一个html并在IE9中打开它,则不会。

<html>
<head>
<style type="text/css">
  #button{background:url("http://www.webstuffshare.com/wp-content/uploads/2010/03/button3.jpg") no-repeat 0 0;display:block;width:201px;height:67px;}
  #button:hover{background-position:0px -67px;}
  #button:active{background-position:0px -134px;}
  #button span{position:absolute;top:-99999999em;}
</style>    
</head>
<body>
  <a id="button" href="#"><span>this is foo</span></a>
</body>
</html>

最好使用 js 事件,因为:active的行为可能会不直观(类似的问题;:活动的 css 选择器不适用于 IE8 和 IE9(

一种

阻碍你想要的行为的方法是;

<a id="button" href="#" onclick="this.blur();" onmouseout="this.blur();"><span>this is foo</span></a>

最新更新