订购供应商特定的CSS声明 [英] Ordering of vendor-specific CSS declarations
问题描述
我想我现在已经写了如下一千次:
I think I've written something like the following a thousand times now:
.foo {
border-radius: 10px; /* W3C */
-moz-border-radius: 10px; /* Mozilla */
-webkit-border-radius: 10px; /* Webkit */
}
但是现在我才想到了那些是重要的?我知道 -moz - *
和 -webkit - *
之间没有关系,因为最多1
But only now have I thought about whether the ordering of those is important? I know that between -moz-*
and -webkit-*
it doesn't matter, since at most 1 of those will be read, but is it better (in terms of future-proofing, etc) to do the W3C standard first or last?
推荐答案
最好的做法是毫无疑问地拥有无前缀的属性:
The best practise is undisputedly to have the unprefixed property last:
.foo {
-moz-border-radius: 10px; /* Mozilla */
-webkit-border-radius: 10px; /* Webkit */
border-radius: 10px; /* W3C */
}
最后一个 -webkit-border-radius
和 border-radius
将被使用。
-webkit-border-radius
是实验性属性 - 实施可能包含与规范的偏差。 border-radius
的实现应该与规范中的内容匹配。
-webkit-border-radius
is the "experimental" property - the implementation may contain deviations from the specification. The implementation for border-radius
should match what's in the specification.
实施,以确保其支持的所有浏览器之间的一致性。
It's preferable to have the W3C implementation used when it's available, to help ensure consistency between all the browsers that support it.
这篇关于订购供应商特定的CSS声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!