前端 - 请问@keyframes当中都要写默认的吗?
PHPz
PHPz 2017-04-17 11:24:07
0
1
1013
@-webkit-keyframes loading {
    0% {
        -webkit-transform: rotate(0deg);
        transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
        transform: rotate(360deg);
    }
}

有这样一段代码定义了一个动画loading,那么定义这个keyframes的时候已经加上了-webkit-前缀了,还需要在代码当中写那个不加前缀的transform吗?

PHPz
PHPz

学习是最好的投资!

reply all(1)
大家讲道理

It is only for compatibility with older versions of -webkit- kernel browsers
If you are sure that the browser is old enough, you can use it directly -webkit-transform: rotate(0deg);.
If you are sure that the browser is new enough, you can use it directly transform: rotate(0deg);
New browsers will recognize it first transform: rotate(0deg);

至于底层没有深究 但是应该是 `-webkit-transform`是对性的消耗应该是超过 
`transform` 所以新旧一般都同时写上(这个等我查了相关api再补充)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template