案例:CSS3案例     状态:可编辑再运行    进入竖版
 运行结果 
x
@-webkit-keyframes myfirst /* Safari and Chrome */
 
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-name:myfirst;
12
animation-duration:5s;
13
animation-timing-function:linear;
14
animation-delay:2s;
15
animation-iteration-count:infinite;
16
animation-direction:alternate;
17
animation-play-state:running;
18
/* Firefox: */
19
-moz-animation-name:myfirst;
20
-moz-animation-duration:5s;
21
-moz-animation-timing-function:linear;
22
-moz-animation-delay:2s;
23
-moz-animation-iteration-count:infinite;
24
-moz-animation-direction:alternate;
25
-moz-animation-play-state:running;
26
/* Safari and Chrome: */
27
-webkit-animation-name:myfirst;
28
-webkit-animation-duration:5s;
29
-webkit-animation-timing-function:linear;
30
-webkit-animation-delay:2s;
31
-webkit-animation-iteration-count:infinite;
32
-webkit-animation-direction:alternate;
33
-webkit-animation-play-state:running;
34
/* Opera: */
35
-o-animation-name:myfirst;
36
-o-animation-duration:5s;
37
-o-animation-timing-function:linear;
38
-o-animation-delay:2s;
39
-o-animation-iteration-count:infinite;
40
-o-animation-direction:alternate;
41
-o-animation-play-state:running;
42
}
43
44
@keyframes myfirst
45
{
46
0%   {background:red; left:0px; top:0px;}
47
25%  {background:yellow; left:200px; top:0px;}
48
50%  {background:blue; left:200px; top:200px;}