实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<meta charset="utf-8"> 
5
<title>手册网(www.shouce.ren)</title> 
6
<style> 
7
#myDIV {
8
    position: absolute;
9
    right: 0;
10
    width: 100px;
11
    height: 100px;
12
    background-color: coral;
13
    color: white;
14
    -webkit-animation: mymove 5s infinite; /* Chrome, Safari, Opera */
15
    animation: mymove 5s infinite;
16
}
17
18
/* Chrome, Safari, Opera */
19
@-webkit-keyframes mymove {
20
    50% {right: 500px;}
21
}
22
23
/* Standard syntax */
24
@keyframes mymove {
25
    50% {right: 500px;}
26
}
27
</style>
28
</head>
29
<body>
30
31
<p>right 属性支持动画效果。</p>
32
<p><b>注意:</b>Internet Explorer 9 及更早 IE 版本不支持 CSS 动画。</p>
33
34
<p>逐步改变 DIV 元素的右边的位置,从 0 到 500px:<p>
35
<div id="myDIV">
36
  <h1>My DIV</h1>
37
</div>
38
39
</body>
40
</html>