css选择伪元素动画

问题描述 投票:6回答:2

为什么animation属性在CSS中的::selection选择器上不起作用?

基本测试用例:

::selection
@keyframes frames{ 
  50%{ color:red } 
}
@-webkit-keyframes frames{ 
  50%{ color:red } 
}

::selection        { background:#EEE;         animation:0.4s frames infinite; }
::-moz-selection   { background:#EEE;         animation:0.4s frames infinite; }
::-webkit-selection{ background:#EEE; -webkit-animation:0.4s frames infinite; }
css css-animations
2个回答
4
投票

我写了Tab Atkins,他回答:

[通常,大多数浏览器在伪元素。我们正在逐步解决这些问题,但进展缓慢工作,因为伪元素在处理中非常复杂浏览器。

最重要的是,:: selection伪元素是most所有CSS中的复杂伪元素。太复杂了,我们在我们的规格中明确取消定义它,直到我们弄清楚如何实际上以一种有效的方式指定它。


3
投票

我在<h2>Selected text should be animated:</h2> CSS3 animations make it possible to animate transitions from one CSS style configuration to another. Animations consist of two components, a style describing the CSS animation and a set of keyframes that indicate the start and end states of the animation's style, as well as possible intermediate waypoints along the way.上看到的大部分是:

适用于:所有元素,:: before和:: after伪元素

哪个建议不建议其他伪元素或状态?

© www.soinside.com 2019 - 2024. All rights reserved.