CSS3 animation-duration 属性 | CSS3教程:CSS3动画

返回到:CSS3动画 | CSS3教程

标签定义及使用说明

animation-duration属性定义动画完成一个周期需要多少秒或毫秒。

默认值:0
继承:no
版本:CSS3
JavaScript 语法:object object.style.animationDuration=”3s”

语法

animation-duration: time;
说明
time指定动画播放完成花费的时间。默认值为 0,意味着没有动画效果。

浏览器支持

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

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

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

实例

设置动画在两秒内完成:

<html><!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 infinite;
	animation-duration:2s;

	/* Safari and Chrome */
	-webkit-animation:mymove infinite;
	-webkit-animation-duration:2s;
}

@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>  animation-duration属性不兼容 Internet Explorer 9 以及更早版本的浏览器.</p>

<div></div>

<p><b>注意:</b> 要指定动画属性。否则时间若是0,动画不会进行。</p>

</body>
</html>

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

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

相关推荐

发表回复

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