margin-top和-webkit-margin-before之间有什么区别

时间:2015-11-06 19:27:45

标签: html css css3 webkit

Webkit已添加了自己的特定边距:

-webkit-margin-before:
-webkit-margin-after:
-webkit-margin-start:
-webkit-margin-end:

我理解(margin-left和-webkit-margin-start)或(margin-right和-webkit-margin-end)的区别,它与"从左到右"或者"从右到左"语言。

我的问题是(margin-top和-webkit-margin-before)或(margin-bottom和-webkit-margin-after)之间有什么区别?

注意:很明显,-webkit前缀仅适用于webkit引擎浏览器,例如chrome和safari。这个问题与它无关。

2 个答案:

答案 0 :(得分:22)

到目前为止我能找到的最佳答案是-web-margin-before与普通文档上的margin-top行为相同,但它会在“自下而上”的语言中充当margin-bottom(同样的想法适用于-webkit-margin-after)。

您可以在此链接中找到多种“自下而上”的语言omniglot.com/writing/direction.htm(感谢@MarkPlewis)

答案 1 :(得分:0)

While Chrome and WebKit supports all the properties and keywords from -webkit-, Safari only supports start (Mozilla does a bit better as it supports both start and end). All these properties are said to work in Safari 6 though; so when that ships, we will need to replace top, right and bottom values with the prefixed properties to make our styling “direction” agnostic.

Basically -webkit- can be used to target different browsers like Safari, Chrome and Firefox. Detail article can be found here.

This article discusses the creation of a base styles sheet for WebKit-based browsers.

To prevent from not applying -webkit- values I use:

*, *:before, *:after {
    box-sizing: inherit;
}