img {
text-align: center;
width: 20px;
margin: auto;
display: block;
-webkit-animation: rotateSpinner 1.2s linear infinite;
}


演示http://jsfiddle.net/cfe2ym54/

这里有什么问题?

最佳答案

您忘记添加keyframes



img {
  text-align: center;
  width: 20px;
  margin: auto;
  display: block;
  -webkit-animation: rotateSpinner 1.2s linear infinite;
  animation: rotateSpinner 1.2s linear infinite;
}
@-webkit-keyframes rotateSpinner {
  to {
    -webkit-transform: rotate(360deg);
  }
}
@keyframes rotateSpinner {
  to {
    transform: rotate(360deg);
  }
}

<div class="loading">
  <img src="http://assets.57square.com/img/loading.png">
</div>

关于css - CSS3动画rotateSpinner不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27853454/

10-10 00:03