转动风车(效果为风车的风页会一直保持转动,下面效果为jpg非gif)
<!DOCTYPE html>
<html lang="en">
<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>风车</title>
<style>
main div{
width: 1000px;
height: 600px;
background-image: url(caodi.png);
background-size: 100% 600px;
margin: 200px auto;
}
/* 定义动画 */
@keyframes donghua{
from{
transform: rotate(0deg);
}
to{
transform: rotate(360deg);
}
}
img{
/* 给所有img对象加上动画 分别是:动画名称 执行每次动画的时间 平缓的 无穷次 */
animation: donghua 2s linear infinite;
}
main div img:nth-child(1){
width: 300px;
height: 300px;
position: relative;
top: 100px;
left:140px;
}
main div img:nth-child(2){
width: 100px;
height: 100px;
position: relative;
top:180px;
left:160px ;
}
main div img:nth-child(3){
width: 200px;
height: 200px;
position: relative;
top: 175px;
left:195px;
}
</style>
</head>
<body>
<main>
<div>
<img src="fengche.png" alt="">
<img src="fengche.png" alt="">
<img src="fengche.png" alt="">
</div>
</main>
</body>
</html>