CSS3 animation-iteration-count 属性 | CSS3教程:CSS3动画

返回到:CSS3动画 | CSS3教程

标签定义及使用说明

animation-iteration-count属性定义动画应该播放多少次。

默认值:1
继承:no
版本:CSS3
JavaScript 语法:object object.style.animationIterationCount=3

语法

animation-iteration-count: value;
描述
n一个数字,定义应该播放多少次动画
infinite指定动画应该播放无限次(永远)

浏览器支持

表格中的数字表示支持该属性的第一个浏览器版本号。

紧跟在 -webkit-, -ms- 或 -moz- 前的数字为支持该前缀属性的第一个浏览器版本号。

属性谷歌IE火狐苹果opera
animation-iteration-count43.0
4.0 -webkit-
10.016.0
5.0 -moz-
9.0
4.0 -webkit-
30.0
15.0 -webkit-
12.0 -o-

实例

播放三次动画:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>Web176教程网(web176.com)</title> 
<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 及更早 IE 版本浏览器不支持 animation-iteration-count 属性。</p>

<div></div>

</body>
</html>

作者:terry,如若转载,请注明出处:https://www.web176.com/css3animate/5055.html

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2022年1月10日 下午2:49
下一篇 2022年1月10日 下午2:53

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注