In Chrome’s user agent stylesheet, why use “-webkit-margin-before” et al instead of just “margin-top” et al?

我的梦境 提交于 2019-12-23 12:19:14

问题


-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?


回答1:


This is to do with layout direction.

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.

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.



来源:https://stackoverflow.com/questions/27707576/in-chrome-s-user-agent-stylesheet-why-use-webkit-margin-before-et-al-instead

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!