当前阅读教程:CSS3教程 > animation-duration 属性 | |||||||||||||
阅读(22555525) 收藏 赞(5685) 分享 | |||||||||||||
上一篇: animation-name 属性 | 下一篇: animation-timing-function 属性 | ||||||||||||
浏览器支持表格中的数字表示支持该属性的第一个浏览器版本号。 紧跟在 -webkit-, -ms- 或 -moz- 前的数字为支持该前缀属性的第一个浏览器版本号。 标签定义及使用说明animation-duration属性定义动画完成一个周期需要多少秒或毫秒。
语法animation-duration: time;
实例设置动画在5秒内完成 代码<!doctype html> <html> <head> <meta charset="utf-8"> <title>animation-duration 属性</title> <!--定义内部样式--> <style> div { width:100px; height:100px; background:red; position:relative; animation:mymove infinite; animation-duration:5s;/*设置动画在两秒内完成*/ /* 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> 效果图 |
|||||||||||||
上一篇: animation-name 属性 | 下一篇: animation-timing-function 属性 |