实例代码“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
    background-color: lightblue;
9
    overflow: auto;
10
    border: 1px solid black;
11
    -webkit-animation: mymove 5s infinite; /* Chrome, Safari, Opera */
12
    animation: mymove 5s infinite;
13
}
14
15
/* Chrome, Safari, Opera */
16
@-webkit-keyframes mymove {
17
    50% {max-width: 600px;}
18
}
19
20
/* Standard syntax */
21
@keyframes mymove {
22
    50% {max-width: 600px;}
23
}
24
</style>
25
</head>
26
<body>
27
28
<p>逐步改变 max-width, 从 "none" 到 "600px":<p>
29
30
<div id="myDIV">
31
  <p>This DIV element does not have a pre-defined width.</p>
32
  <p>Try resizing the browser window to see that width of this DIV element will grow/shrink along width the resizing, but it will never exceed 600 pixels in width.</p>
33
</div>
34
35
<p>max-width 属性支持动画效果。</p>
36
<p><b>注意:</b> 目前 max-height 属性在 Chrome 浏览器下不会改变 <em>gradually(灰阶)</em>, 在 Firefox 都无法起作用。</p>
37
<p><b>注意:</b>Internet Explorer 9 及更早 IE 版本不支持 CSS 动画。</p>
38
39
</body>
40
</html>