动画(练习2)
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>动画(练习2)</title>
<!-- <link rel="stylesheet" href="../chujicss/css/11.27.07.css"> -->
<style type="text/css">
.box {
width: 96px;
height: 96px;
margin: 0 auto;
background-image: url(./chujicss\ img/11.27.07.jpg);
animation: run 10s steps(1) infinite;
}
@keyframes run {
0% {
background-position: 0 0
}
5% {
background-position: -100% 0
}
10% {
background-position: -200% 0
}
15% {
background-position: -300% 0
}
20% {
background-position: -400% 0
}
25% {
background-position: 0 -100%
}
30% {
background-position: -100% -100%
}
35% {
background-position: -200% -100%
}
40% {
background-position: -300% -100%
}
45% {
background-position: -400% -100%
}
50% {
background-position: 0 -200%
}
55% {
background-position: -100% -200%
}
60% {
background-position: -200% -200%
}
65% {
background-position: -300% -200%
}
70% {
background-position: -400% -200%
}
75% {
background-position: 0 -300%
}
80% {
background-position: -100% -300%
}
85% {
background-position: -200% -300%
}
90% {
background-position: -300% -300%
}
95% {
background-position: -400% -300%
}
100% {
background-position: 0 0
}
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
运行结果为:
代码引用的图片是: