In the Chromes user agent stylesheet, why use "-webkit-margin-before", etc. Instead of "margin-top" et al?

-webkit-margin-{before,after,start,end} can be redefined to margin-{top,bottom,left,right} respectively. Why doesn't the Chromes user agent stylesheet just use standard margin- ?

enter image description here

+5
source share
1 answer

This is due to the layout layout.

So, -webkit-margin-start looks like margin-left when the direction of the layout 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 focus is important, user agent values ​​for these properties can be overridden. Where it does not matter, return to the standard field properties automatically.

+6
source

Source: https://habr.com/ru/post/1210109/


All Articles