?
This document uses PHP Chinese website manual Release
animation-name:<single-animation-name>[,<single-animation-name>]*
<single-animation-name> = none | <identifier>
默認(rèn)值:none
適用于:所有元素,包含偽對象:after和:before
繼承性:無
動畫性:否
計算值:指定值
媒體:視覺
相關(guān)屬性:[ @keyframes ]
none:不引用任何動畫名稱
<identifier>:定義一個或多個動畫名稱(identifier標(biāo)識)
如果提供多個屬性值,以逗號進(jìn)行分隔。
對應(yīng)的腳本特性為animationName。
Values | IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|---|
Basic Support | 6.0-9.0 | 2.0-4.0 | 4.0-42.0-webkit- | 6.0-8.0-webkit- | 15.0-29.0-webkit- | 6.0-8.4-webkit- | 2.1-3.0-webkit- #1 | 18.0-42.0-webkit- |
10.0+ | 5.0-15.0-moz- | 43.0+ | 9.0+ | 30.0+ | 9.0+ | 4.0-40.0-webkit- | ||
16.0+ |
在一些場景中會有錯誤行為
部分瀏覽器不支持偽元素動畫,或者支持得不夠好,盡可能不要利用偽元素來做動畫
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8" /> <title>animation-name_CSS參考手冊_web前端開發(fā)參考手冊系列</title> <meta name="author" content="Joy Du(飄零霧雨), dooyoe@gmail.com, www.doyoe.com" /> <style> div{position:absolute;top:50%;left:50%;width:300px;height:150px;margin:-75px 0 0 -150px;} .over{border:3px solid #eee;background:#e0e0e0;} .text{font:bold 14px/150px Georgia;text-align:center;} .over{ -webkit-animation:animations 2.5s ease-out forwards,animations3 1s ease-out 2.5s forwards; -moz-animation:animations 2.5s ease-out forwards,animations3 1s ease-out 2.5s forwards; animation:animations 2.5s ease-out forwards,animations3 1s ease-out 2.5s forwards; } @-webkit-keyframes animations{ 0%{-webkit-transform:scale(0);opacity:0;} 40%{-webkit-transform:scale(1);opacity:1;} 100%{opacity:1;} } @-moz-keyframes animations{ 0%{-moz-transform:scale(0);opacity:0;} 40%{-moz-transform:scale(1);opacity:1;} 100%{opacity:1;} } @keyframes animations{ 0%{transform:scale(0);opacity:0;} 40%{transform:scale(1);opacity:1;} 100%{opacity:1;} } .text{ opacity: 0; -webkit-animation:animations2 1.5s ease-out 1s forwards; -moz-animation:animations2 1.5s ease-out 1s forwards; animation:animations2 1.5s ease-out 1s forwards; } @-webkit-keyframes animations2{ 0%{-webkit-transform:scale(4);opacity:0;} 40%{-webkit-transform:scale(2);opacity:1;} 70%{-webkit-transform:scale(2);opacity:1;} 100%{-webkit-transform:scale(5);opacity:0;} } @-moz-keyframes animations2{ 0%{-moz-transform:scale(4);opacity:0;} 40%{-moz-transform:scale(2);opacity:1;} 70%{-moz-transform:scale(2);opacity:1;} 100%{-moz-transform:scale(5);opacity:0;} } @keyframes animations2{ 0%{transform:scale(4);opacity:0;} 40%{transform:scale(2);opacity:1;} 70%{transform:scale(2);opacity:1;} 100%{transform:scale(5);opacity:0;} } @-webkit-keyframes animations3{ 0%{-webkit-transform:scale(1);opacity:1;} 100%{-webkit-transform:scale(0);opacity:0;} } @-moz-keyframes animations3{ 0%{-moz-transform:scale(1);opacity:1;} 100%{-moz-transform:scale(0);opacity:0;} } @keyframes animations3{ 0%{transform:scale(1);opacity:1;} 100%{transform:scale(0);opacity:0;} } </style> </head> <body> <div class="over"></div> <div class="text">CSS3 Animations</div> </body> </html>
點(diǎn)擊 "運(yùn)行實例" 按鈕查看在線實例