首页 > web前端 > css教程 > css3动画不循环怎么办

css3动画不循环怎么办

醉折花枝作酒筹
发布: 2023-01-07 11:45:27
原创
3350 人浏览过

css3动画不循环可以使用animation-iteration-count属性定义动画的播放次数。只需要在动画中添加“animation-iteration-count:infinite;”即可实现无限次循环。

css3动画不循环怎么办

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

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

语法

1

animation-iteration-count: n|infinite;

登录后复制

L}}4Q41OIKC{D_VSBJ4R9HU.png

实例

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

<!DOCTYPE html>

<html>

<head>

<style>

div

{

width:100px;

height:100px;

background:red;

position:relative;

animation:mymove 3s;

animation-iteration-count:3;

 

/* Safari and Chrome */

-webkit-animation:mymove 3s;

-webkit-animation-iteration-count:3;

}

 

@keyframes mymove

{

from {top:0px;}

to {top:200px;}

}

 

@-webkit-keyframes mymove /* Safari and Chrome */

{

from {top:0px;}

to {top:200px;}

}

</style>

</head>

<body>

 

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

 

<div></div>

 

</body>

</html>

登录后复制

效果:

GIF.gif

推荐学习:css视频教程

以上是css3动画不循环怎么办的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板