IE8很奇怪:之前和背景
我使用:before和background来模拟无线电输入,下面是代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width" />
<title>Welcome to Foundation</title>
<script src="javascripts/modernizr.foundation.js"></script>
<link rel="stylesheet" href="stylesheets/docs.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"> </script>
<style>
#aaa:before {
width:16px;
height:16px;
content:"";
display:block;
background: transparent url('img/7.png') -2px -2px no-repeat;
}
#aaa.checked:before {
background-position: -38px -2px;
}
</style>
</head>
<body>
<div id="aaa" onclick='$("#aaa").toggleClass("checked")'></div>
</body>
</html>
在Chrome上,单击图像,效果很好,在IE8上,没有第一次点击图像的效果,第二次,它的工作很奇怪。