案例:CSS3案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style> 
5
div
6
{
7
width:100px;
8
height:100px;
9
background:red;
10
animation:myfirst 5s;
11
-moz-animation:myfirst 5s; /* Firefox */
12
-webkit-animation:myfirst 5s; /* Safari and Chrome */
13
-o-animation:myfirst 5s; /* Opera */
14
}
15
16
@keyframes myfirst
17
{
18
0%   {background:red;}
19
25%  {background:yellow;}
20
50%  {background:blue;}
21
100% {background:green;}
22
}
23
24
@-moz-keyframes myfirst /* Firefox */
25
{
26
0%   {background:red;}
27
25%  {background:yellow;}
28
50%  {background:blue;}
29
100% {background:green;}
30
}
31
32
@-webkit-keyframes myfirst /* Safari and Chrome */
33
{
34
0%   {background:red;}
35
25%  {background:yellow;}
36
50%  {background:blue;}
37
100% {background:green;}
38
}
39
40
@-o-keyframes myfirst /* Opera */
41
{
42
0%   {background:red;}
43
25%  {background:yellow;}
44
50%  {background:blue;}
45
100% {background:green;}
46
}
47
</style>
48
</head>