?
本文檔使用 php中文網(wǎng)手冊 發(fā)布
animation-iteration-count:<single-animation-iteration-count>[,<single-animation-iteration-count>]*
<single-animation-iteration-count> = infinite | <number>
默認值:1
適用于:所有元素,包含偽對象:after和:before
繼承性:無
動畫性:否
計算值:指定值
媒體:視覺
infinite:無限循環(huán)
<number>:指定對象動畫的具體循環(huán)次數(shù)
如果提供多個屬性值,以逗號進行分隔。
對應(yīng)的腳本特性為animationIterationCount。
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-iteration-count_CSS參考手冊_web前端開發(fā)參考手冊系列</title> <meta name="author" content="Joy Du(飄零霧雨), dooyoe@gmail.com, www.doyoe.com" /> <style> h1{font-size:16px;} div{width:100px;height:100px;padding:10px;border-radius:61px;box-shadow:0 0 10px rgba(204,102,0,.8);background:#F6D66E;background:-moz-linear-gradient(top,#fff,#F6D66E);background:-webkit-linear-gradient(top,#fff,#F6D66E);background:linear-gradient(to bottom,#fff,#F6D66E); -moz-animation:animations 1.5s ease infinite; -webkit-animation:animations 1.5s ease infinite; animation:animations 1.5s ease infinite; } @-webkit-keyframes animations{ 0%{box-shadow:0 0 10px rgba(204,102,0,.8);} 50%{box-shadow:0 0 10px rgba(204,102,0,.3);} 100%{box-shadow:0 0 10px rgba(204,102,0,.8);} } @-moz-keyframes animations{ 0%{box-shadow:0 0 10px rgba(204,102,0,.8);} 50%{box-shadow:0 0 10px rgba(204,102,0,.3);} 100%{box-shadow:0 0 10px rgba(204,102,0,.8);} } @keyframes animations{ 0%{box-shadow:0 0 10px rgba(204,102,0,.8);} 50%{box-shadow:0 0 10px rgba(204,102,0,.3);} 100%{box-shadow:0 0 10px rgba(204,102,0,.8);} } </style> </head> <body> <h1>太陽光暈將不停的閃爍:</h1> <div></div> </body> </html>
點擊 "運行實例" 按鈕查看在線實例