Can you change CSS3 animation keyframe attributes inline (i.e. in the HTML style attribute)?

后端 未结 6 1608
别跟我提以往
别跟我提以往 2020-12-31 03:01

Is it possible to change the animation keyframe attributes by making inline adjustments.

Take for example

@-moz-keyframes slidein {
    from {
               


        
6条回答
  •  悲&欢浪女
    2020-12-31 03:10

    Here's a way to do this using CSS variables:

    @keyframes slide {
      from {
        width: var(--from-width);
      }
    
      to {
        width:var(--to-width);
      }
    }
    

    That obviously won't work for all cases, but if you just need to customize some numbers in an existing set of keyframes, then it may work for you.

提交回复
热议问题