当前位置:Gxlcms > JavaScript > cssanimation-iteration-count属性怎么用

cssanimation-iteration-count属性怎么用

时间:2021-07-01 10:21:17 帮助过:55人阅读

css animation-iteration-count属性是用于定义动画播放次数的;设置animation-iteration-count属性的值为infinite,就可实现动画的无限循环播放。

css animation-iteration-count属性怎么用?

作用:animation-iteration-count 属性定义动画的播放次数。

语法:

  1. animation-iteration-count: n|infinite;

说明:n 定义动画播放次数的数值。infinite 规定动画应该无限次播放。

注释:Internet Explorer 9 以及更早的版本不支持 animation-iteration-count 属性。

css animation-iteration-count属性使用示例

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. div
  6. {
  7. width:100px;
  8. height:100px;
  9. background:red;
  10. position:relative;
  11. animation:mymove 3s;
  12. animation-iteration-count:3;
  13. /* Safari and Chrome */
  14. -webkit-animation:mymove 3s;
  15. -webkit-animation-iteration-count:3;
  16. }
  17. @keyframes mymove
  18. {
  19. from {top:0px;}
  20. to {top:200px;}
  21. }
  22. @-webkit-keyframes mymove /* Safari and Chrome */
  23. {
  24. from {top:0px;}
  25. to {top:200px;}
  26. }
  27. </style>
  28. </head>
  29. <body>
  30. <p><strong>注释:</strong>Internet Explorer 9 以及更早的版本不支持 animation-iteration-count 属性。</p>
  31. <div></div>
  32. </body>
  33. </html>

效果:

36caeadafb33b6029c7c1884e3ab1b2.png

以上就是css animation-iteration-count属性怎么用的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行