我们想知道如何创建CSS sprite 表动画。
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.hi {
width: 50px;
height: 72px;
background-image: url("http://www.w3cschool.cn/style/download.png");
-webkit-animation: play .8s steps(10) infinite;
-moz-animation: play .8s steps(10) infinite;
-ms-animation: play .8s steps(10) infinite;
-o-animation: play .8s steps(10) infinite;
animation: play .8s steps(10) infinite;
}
@-webkit-keyframes play {
from { background-position:0px;}
to {background-position: -500px;}
}
@-moz-keyframes play {
from { background-position:0px;}
to {background-position: -500px;}
}
@-ms-keyframes play {
from { background-position:0px;}
to {background-position: -500px;}
}
@-o-keyframes play {
from { background-position:0px;}
to {background-position: -500px;}
}
@keyframes play {
from { background-position:0px;}
to {background-position: -500px;}
}
</style>
</head>
<body>
<div class="hi"></div>
</body>
</html>