【发布时间】:2016-12-12 04:08:21
【问题描述】:
以我自己的个人风格,我喜欢使用类似命令行参数的语法添加小的帮助 CSS 类,例如
<div class="button --small --red"></div>
但我今天意识到任何以-- 为前缀的类在 Safari 和 iOS 中都会被忽略,但在 Firefox 和 Chrome 中似乎可以正常工作。这有什么原因吗?
【问题讨论】:
-
相关:Can CSS identifiers begin with two hyphens? - 简而言之,Firefox 允许它是因为 css-variables 允许它,而 Chrome 允许它是因为 Chrome 曾经有一个 css-variables 实现,但后来被废弃了,或者因为 Chrome .