案例:CSS3 案例     状态:可编辑再运行    进入横版
x
<p><strong>注释:</strong>Internet Explorer 9 以及更早的版本不支持 animation-direction 属性。</p>
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style> 
5
div
6
{
7
width:100px;
8
height:100px;
9
background:red;
10
position:relative;
11
animation:myfirst 5s infinite;
12
animation-direction:alternate;
13
14
/* Safari and Chrome */
15
-webkit-animation:myfirst 5s infinite;
16
-webkit-animation-direction:alternate;
17
}
18
19
@keyframes myfirst
20
{
21
0%   {background:red; left:0px; top:0px;}
22
25%  {background:yellow; left:200px; top:0px;}
23
50%  {background:blue; left:200px; top:200px;}
24
75%  {background:green; left:0px; top:200px;}

 运行结果 
 北美留学生论坛