案例:CSS3 案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
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:mymove 5s infinite;
12
-moz-animation:mymove 5s infinite; /* Firefox */
13
-webkit-animation:mymove 5s infinite; /* Safari and Chrome */
14
-o-animation:mymove 5s infinite; /* Opera */
15
}
16
17
@keyframes mymove
18
{
19
0%   {top:0px; background:red; width:100px;}
20
100% {top:200px; background:yellow; width:300px;}
21
}
22
23
@-moz-keyframes mymove /* Firefox */
24
{
25
0%   {top:0px; background:red; width:100px;}
26
100% {top:200px; background:yellow; width:300px;}
27
}
28
29
@-webkit-keyframes mymove /* Safari and Chrome */
30
{
31
0%   {top:0px; background:red; width:100px;}
32
100% {top:200px; background:yellow; width:300px;}
33
}
34
35
@-o-keyframes mymove /* Opera */
36
{
37
0%   {top:0px; background:red; width:100px;}
38
100% {top:200px; background:yellow; width:300px;}
39
}
40
</style>
41
</head>
42
<body>
43
44
<p><b>注释:</b>本例在 Internet Explorer 中无效。</p>
45
46
<div></div>
47
48
</body>