Using an inline animation keyframes definition?

后端 未结 1 984
误落风尘
误落风尘 2021-02-08 23:51

We have this sort of syntax for defining key frames in a css file:

@-webkit-keyframes fade {
    from {opacity: 1;}
    to {opacity: 0.25;}
}

a

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-09 00:15

    Taking a look at the W3C CSS Animations WD, the syntax for the animation shorthand property is:

    [ ||  ||  || 
      ||  ||  || 
     ] [, [ ||  ||
      ||  ||  ||
      || ] ]* 
    

    Meaning it takes only the animation-name which is used to select the keyframe at-rule that provides the property values for the animation, followed by the other parameters which define how these rules should be executed.

    There's currently no shorthand syntax defined in the specs that would allow for defining an inline keyframe at-rule, you have to reference an existing one using the animation-name property. From the specs:

    The 'animation-name' property defines a list of animations that apply. Each name is used to select the keyframe at-rule that provides the property values for the animation. If the name does not match any keyframe at-rule, there are no properties to be animated and the animation will not execute.

    0 讨论(0)
提交回复
热议问题