ctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>图片上下浮动</title>
<style>
* {
padding: 0;
margin: 0;
}
body {
position: relative;
background: #90C0F1;
overflow: hidden;
}
.ghost {
width: 160px;
margin: 100px auto;
position: relative;
animation: ghostUpdown 1s infinite alternate;
-webkit-animation: ghostUpdown 1s infinite alternate;
}
@keyframes ghostUpdown {
from {
margin-top: 100px;
}
to {
margin-top: 70px;
}
}
@-webkit-keyframes ghostUpdown {
from {
margin-top: 100px;
}
to {
margin-top: 70px;
}
}
</style>
</head>
<body>
<div class="ghost">
<img src="http://statics.76sd.com//data/files/recommend/20180423/5add389c5baaf.jpg "> </div>
</body>
</html>
css3图片上下浮动动画
最新推荐文章于 2024-03-29 03:34:03 发布