小编典典

CSS动画:可以在Chrome浏览器中使用,但不能在Firefox中使用吗?

css

在旋转动画中,只能在Chrome浏览器中使用,而不能在Firefox中使用。为什么?

@-moz-keyframes rotate {
    from { -moz-transform: rotate(0deg); }
    to { -moz-transform: rotate(360deg); }
}

@-webkit-keyframes rotate {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}

#example {
    background: red;
    width: 100px;
    height: 100px;
    -moz-animation: rotate 20s linear 0 infinite;
    -webkit-animation: rotate 20s linear 0 infinite;
}

阅读 353

收藏
2020-05-16

共1个答案

小编典典

当前的Firefox实施失败,除非时间值0具有单位。使用0s0ms

注意:W3C明确允许数字0(不带单位)作为长度值,但对于其他值则没有这种意义。我个人希望这种情况有所改变,但目前Firefox的行为并不正确。

2020-05-16