2016-11-12 59 views
0

我似乎无法让我的动画工作。我想让它旋转180度,没有任何事情发生。我是否将我的代码放在错误的位置?这里是我的CSS代码:试图让我的旋转动画工作。怎么了?

@keyframes headerspin { 
    from { 
     transform: rotation(0deg); 
    } 

    to { 
     transform: rotation(180deg); 
    } 
} 

这里就是我想插入我的动画:

img#headergif { 
    animation-name: headerspin; 
    animation-duration: 1.5s; 
} 

回答

1

代替transform: rotation(0deg);使用transform: rotate(0deg);

div { 
 
      width: 100px; 
 
      height: 100px; 
 
      background-color: red; 
 
      -webkit-animation-name: example; 
 
      -webkit-animation-duration: 4s; 
 
      animation-name: example; 
 
      animation-duration: 4s; 
 
     } 
 
     
 
     @keyframes example { 
 
      from { 
 
       transform: rotate(0deg); 
 
      } 
 
      to { 
 
       transform: rotate(180deg); 
 
      } 
 
     }
<!DOCTYPE html> 
 
<html> 
 
<body> 
 

 
    <div></div> 
 

 
</body> 
 

 
</html>