CSS3 transition 浏览器兼容性

时间:2022-08-26 15:07:48

1、兼容性

根据canius(http://caniuse.com/#search=transition),transition 兼容性如下图所示:

CSS3 transition 浏览器兼容性

 

 

 1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 div
6 {
7 width:100px;
8 height:100px;
9 background:blue;
10 transition:width 2s;
11 -moz-transition:width 2s; /* Firefox 4 */
12 -webkit-transition:width 2s; /* Safari and Chrome */
13 -o-transition:width 2s; /* Opera */
14 }
15
16 div:hover
17 {
18 width:300px;
19 }
20 </style>
21 </head>
22 <body>
23
24 <div></div>
25
26 <p>请把鼠标指针移动到蓝色的 div 元素上,就可以看到过渡效果。</p>
27
28 <p><b>注释:</b>本例在 Internet Explorer 中无效。</p>
29
30 </body>
31 </html>

 在IE7-9进行测试时,transition的效果没有过渡效果(如线性过渡效果),但是还是有效果(立即执行transition-propertytransition-durationtransition-timing-functiontransition-delay都不起作用)