1、兼容性
根據canius(http://caniuse.com/#search=transition),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-property,transition-duration,transition-timing-function,transition-delay都不起作用)