Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS动画不工作?_Html_Css_Css Animations - Fatal编程技术网

Html CSS动画不工作?

Html CSS动画不工作?,html,css,css-animations,Html,Css,Css Animations,我想先旋转对象,使其落下。 这是我的密码。不确定是什么错误 CSS body { } #hammer { -webkit-animation: hammer 5s linear 2s infinite; -moz-animation: hammer 5s linear 2s infinite; animation: hammer 5s linear 2s infinite; } @-webkit-keyframes myfirst { 0% {-webkit

我想先旋转对象,使其落下。
这是我的密码。不确定是什么错误

CSS

body {
}
#hammer
{
    -webkit-animation: hammer 5s linear 2s infinite;
    -moz-animation: hammer 5s linear 2s infinite;
    animation: hammer 5s linear 2s infinite;
}
@-webkit-keyframes myfirst
 {
     0%  {-webkit-transform: rotateY(360deg);}
    100%  {-webkit-transform: rotateY(360deg);}
}
@keyframes myfirst 
{
    0%  {transform: rotateY(360deg);}
    100%  {transform: rotateY(360deg);}
}
@-moz-keyframes myfirst
 {
     0%  {-moz-transform: rotateY(360deg);}
    100%  {-moz-transform: rotateY(360deg);}
}
HTML

<center><img id="hammer" src="hammer.png" alt="hammer" width="100" height="100" /></center>

因为您正在从360旋转到360,所以什么都没有发生。尝试从0旋转到360

  • 您需要将“hammer”更改为真实动画的名称“myfirst”

    动画:我的第一个0.4s轻松

  • 添加一个过渡到
    #hammer
    以柔和地查看动画

    #hammer {
        transition: all 0.5s ease
    }