如何使用 CSS 将徽标旋转 360 度?

Y M*_*esh 2 html css wordpress

我正在开发一个网站,想要将徽标旋转 360 度。网站网址是http://flipped.in/JSJ/

我正在使用的示例代码是:

.rotate{
    -webkit-transition-duration: 0.8s;
    -moz-transition-duration: 0.8s;
    -o-transition-duration: 0.8s;
    transition-duration: 0.8s;
     
    -webkit-transition-property: -webkit-transform;
    -moz-transition-property: -moz-transform;
    -o-transition-property: -o-transform;
    transition-property: transform;
     
    overflow:hidden;
 
    }  
 
.rotate:hover  
{
    -webkit-transform:rotate(360deg);
    -moz-transform:rotate(360deg);
    -o-transform:rotate(360deg);
}  
Run Code Online (Sandbox Code Playgroud)

现在,我尝试将“旋转”类替换为我的徽标所具有的类,但它不起作用。有人可以帮我添加正确的课程吗?

Juk*_*ela 5

该代码在 Chrome 和 Firefox 上同样有效。它不适用于 IE,因为 IE(在现代版本中)实现了所涉及属性的标准名称,并且代码transform在其标准名称下缺少属性的设置。添加它使得代码可以在现代浏览器上运行。

<style>
.rotate{
    -webkit-transition-duration: 0.8s;
    -moz-transition-duration: 0.8s;
    -o-transition-duration: 0.8s;
    transition-duration: 0.8s;   
    -webkit-transition-property: -webkit-transform;
    -moz-transition-property: -moz-transform;
    -o-transition-property: -o-transform;
    transition-property: transform;    
    overflow:hidden;
     }  
 .rotate:hover  
{
    -webkit-transform:rotate(360deg);
    -moz-transform:rotate(360deg);
    -o-transform:rotate(360deg);
    transform:rotate(360deg);         /* This was missing. */
} 
</style>
<img class=rotate src=
"http://flipped.in/JSJ/wp-content/uploads/2014/12/JSJ-Logo.png"
 alt="Jump Start Jonny">
Run Code Online (Sandbox Code Playgroud)