<!DOCTYPE html>
<html>
<head>
<style>
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:go 1s infinite;
-moz-animation:go 1s infinite; /* Firefox */
-webkit-animation:go 1s infinite; /* Safari and Chrome */
-o-animation:go 1s infinite; /* Opera */
animation-direction: alternate;
}
@keyframes go{
0% {left:0px;}
100% {left:200px;}
}
@-moz-keyframes go /* Firefox */
{
0% {left:0px;}
100% {left:200px;}
}
@-webkit-keyframes go /* Safari and Chrome */
{
0% {left:0px;}
100% {left:200px;}
}
@-o-keyframes go /* Opera */
{
0% {left:0px;}
to {left:200px;}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
CSS3动画使用方法实例
最新推荐文章于 2021-06-07 16:43:57 发布