CSS Transitions with :before and :after pseudo elements

前端 未结 3 1360
慢半拍i
慢半拍i 2020-12-15 16:00

Can\'t seem to animate pseudo elements with -webkit-transition. The fiddle below shows what I mean when run in Chrome/Safari, I guess this isn\'t supported right now?

<
3条回答
  •  忘掉有多难
    2020-12-15 16:58

    Well, actually, you can.

    You just need to leverage the often forgotten inherit value. Unfortunately we can't (yet) directly target pseudo-elements with custom animations, but we surely can let them share the same animation of the "parent" element by inheriting the properties we wish to animate.

    See my fiddle here.

提交回复
热议问题