background需要负值定位,移动的是图片
<title>奔跑的少年</title>
<style>
.box1{
width: 126.2px;
height: 128px;
margin: 0 auto;
background-image: url(../项目练习exercise/练习的截图/奔跑的少年.jpg);
animation: run 1s steps(6) infinite;
}
@keyframes run{
from{
background-position: 0 0;
}
to{
background-position: -757px;
}
}
</style>
</head>
<body>
<div class="box1"></div>
</body>
</html>