在Chrome的用户代理样式表中,为什么要使用“-webkit-margin-before”而不是仅仅是“边缘顶部”。 et al? [英] In Chrome’s user agent stylesheet, why use "-webkit-margin-before" et al instead of just "margin-top" et al?
问题描述
-webkit-margin- {before,after,start,end} 可以被
margin- {top,bottom,left,right }
。为什么Chrome的用户代理样式表不仅仅使用标准的 margin -
声明?
-webkit-margin-{before,after,start,end}
can be overriden by margin-{top,bottom,left,right}
respectively. Why does Chrome’s user agent stylesheet not just use the standard margin-
declarations?
推荐答案
这是与布局方向有关。
This is to do with layout direction.
因此 -webkit-margin-start
就像 margin-left
当布局方向是从左到右,但当方向是从右到左时, margin-right
。
So -webkit-margin-start
is like margin-left
when the layout direction is left-to-right, but like margin-right
when the direction is right-to-left.
请参阅 http://jsfiddle.net/jLnz2jd1/ (在Chrome中,显然)
See http://jsfiddle.net/jLnz2jd1/ (In Chrome, obviously)
在方向性重要的上下文中,可以覆盖这些属性的用户代理值。在哪里无关紧要,自动退回到标准保证金属性。
In contexts where directionality matters, the user-agent values for these properties can be overridden. Where it doesn't matter the fallback to the standard margin properties is automatic.
这篇关于在Chrome的用户代理样式表中,为什么要使用“-webkit-margin-before”而不是仅仅是“边缘顶部”。 et al?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!