Firefox中的CSS动画不起作用

Iva*_*van 6 html css html5 css3

您好我为我的盒子创建动画,所有工作都在chrome中.但在Firefox中不工作.我尝试使用-moz-但是再没有.

动画的CSS代码我使用的是:

@-webkit-keyframes pulse {
  from {
    -webkit-transform: scale(1.0);
    opacity: 0.75;
  }
  50% {
    -webkit-transform: scale(1.2);
    opacity: 1.0;
  }
  to { 
    -webkit-transform: scale(1.0);
    opacity: 0.75;
  }
}

div.pulse { opacity: 0.75; }
div.pulse:hover {
  -moz-animation-name: pulse; 
  -moz-animation-duration: 0.5s; 
  -moz-animation-iteration-count: 1; 

  -webkit-animation-name: pulse; 
  -webkit-animation-duration: 0.5s; 
  -webkit-animation-iteration-count: 1; 
}
Run Code Online (Sandbox Code Playgroud)

谁能说出我做错了什么?什么不在莫兹拉工作?

Pau*_*e_D 7

您需要定义动画和转换的FF版本以及 webkit版本

@-moz-keyframes pulse { /* older versions of FF */
  from {
    -moz-transform: scale(1.0);
    opacity: 0.75;
  }
  50% {
    -moz-transform: scale(1.2);
    opacity: 1.0;
  }
  to { 
    -moz-transform: scale(1.0);
    opacity: 0.75;
  }
}

@keyframes pulse {
  from {
    transform: scale(1.0);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.2);
    opacity: 1.0;
  }
  to { 
    transform: scale(1.0);
    opacity: 0.75;
  }
}
Run Code Online (Sandbox Code Playgroud)