欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
  CSS3animation-fill-mode属性
 
  作用:animation-fill-mode属性规定动画在播放之前或之后,其动画效果是否可见。
 
  说明:默认情况下,CSS动画在第一个关键帧播放完之前不会影响元素,在最后一个关键帧完成后停止影响元素。animation-fill-mode属性可重写该行为。
 
  语法:
 
  animation-fill-mode:none|forwards|backwards|both;
 
  none:不改变默认行为。
 
  forwards:当动画完成后,保持最后一个属性值(在最后一个关键帧中定义)。
 
  backwards:在animation-delay所指定的一段时间内,在动画显示之前,应用开始属性值(在第一个关键帧中定义)。
 
  both:向前和向后填充模式都被应用。
 
  注:InternetExplorer9以及更早的版本不支持animation-fill-mode属性。
 
  CSS3animation-fill-mode属性的使用示例
 
  
 
  
 
  <!DOCTYPEhtml>
 
  <html>
 
  <head>
 
  <metacharset="utf-8">
 
  <title></title>
 
  <style>
 
  div
 
  {
 
  width:100px;
 
  height:100px;
 
  background:red;
 
  position:relative;
 
  animation:mymove3s;
 
  animation-iteration-count:2;
 
  animation-fill-mode:forwards;
 
  /*Safari和Chrome*/
 
  -webkit-animation:mymove3s;
 
  -webkit-animation-iteration-count:2;
 
  -webkit-animation-fill-mode:forwards;
 
  }
 
  @keyframesmymove
 
  {
 
  from{top:0px;}
 
  to{top:200px;}
 
  }
 
  @-webkit-keyframesmymove/*Safari和Chrome*/
 
  {
 
  from{top:0px;}
 
  to{top:200px;}
 
  }
 
  </style>
 
  </head>
 
  <body>
 
  <div></div>
 
  </body>
 
  </html>



 

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c56264.shtml