HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小鸟飞</title>
<link rel="stylesheet" type="text/css" href="../css/小鸟.css"/>
</head>
<body>
<div class="box"></div>
</body>
</html>
CSS:
.box{
width: 140px;
height:98px;
background: url(../img/bird.png) no-repeat ;
animation: fly .5s steps(8) infinite ,name 5s linear infinite ; /* 调用 */
}
@keyframes fly{ /* key帧 */
0%{
background-position: 0 0;
}
100%{
background-position:-1102px 0;
}
}
@keyframes name{
0%{
margin-left: 0px;
}
100%{
margin-left: 1500px;
}
}