<style type="text/css">
.userimg {
display: inline-block;
width: 36px;
height: 36px;
border-radius: 100%;
background: url(img/bg_base_spr24.png) no-repeat -100px 0;
vertical-align: top;
margin-right: 10px;
}
.userimg:hover {
border-color: #ffc52a;
-webkit-animation: wakeup .2s steps(3) both;
animation: wakeup .2s steps(3) both;
}
@-webkit-keyframes wakeup {
0% {
background-position: -100px 0;
}
100% {
background-position: -250px 0;
}
}
@keyframes wakeup {
0% {
background-position: -100px 0;
}
100% {
background-position: -250px 0;
}
}
</style>
</head>
<body>
<span class="userimg"></span>
</body>
animation: wakeup .2s steps(3) both;
动画总时长0.2s,在3帧之间切换