【发布时间】:2014-01-12 14:18:22
【问题描述】:
是否可以在 CSS3 中使用通配符作为属性值?
如果有帮助,我会使用 LESS。
例如假设类名是animation-delay-8
[class^=animation-delay-] {
-webkit-animation-delay: // the value should be 8
}
【问题讨论】:
-
不可能。您需要使用 JavaScript 或硬编码这些值。
-
LESS 最后仍然会吐出 CSS,所以它没有任何区别。在生成的 CSS 文件中仍然会有大量的
.animation-delay-1 { -webkit-animation-delay: 1; }s。 LESS 可以帮助您简化编写过程,因为您可以从 1 循环到 20。 -
好的,谢谢。应该添加您的评论作为答案,以便我接受它