Html margin-top 和 -webkit-margin-before 的区别是什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33574237/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 18:27:48  来源:igfitidea点击:

What is the difference of margin-top and -webkit-margin-before

htmlcsswebkit

提问by Arashsoft

Webkit have added its own specific margins which are:

Webkit 添加了自己的特定边距,它们是:

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

I understand the difference of (margin-left and -webkit-margin-start) or (margin-right and -webkit-margin-end) which is related to "left to right" or "right to left" languages.

我了解 (margin-left 和 -webkit-margin-start) 或 (margin-right 和 -webkit-margin-end) 的区别,这与“从左到右”或“从右到左”语言有关。

My question is what is the difference between (margin-top and -webkit-margin-before) or (margin-bottom and -webkit-margin-after) ?

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

Note: It is obvious that -webkit prefix only works on webkit engine browsers such as chrome and safari. This question is not related to it.

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

采纳答案by Arashsoft

The best answer I could find so far is -web-margin-beforeacts same as margin-topon normal documents but it will act as margin-bottomon "bottom to top" languages (same idea applies to -webkit-margin-after).

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

You can find a number of "bottom to top" languages in this link omniglot.com/writing/direction.htm(thanks to @MarkPlewis)

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

回答by prashmi

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.

虽然 Chrome 和 WebKit 支持 -webkit- 中的所有属性和关键字,但 Safari 只支持开始(Mozilla 做得更好,因为它支持开始和结束)。不过,据说所有这些属性都可以在 Safari 6 中使用;因此,当它发布时,我们需要用前缀属性替换 top、right 和 bottom 值,以使我们的样式“方向”不可知。

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

基本上 -webkit- 可用于针对不同的浏览器,如 Safari、Chrome 和 Firefox。详细文章可以在这里找到。

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

本文讨论为基于 WebKit 的浏览器创建基本样式表。

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

为了防止不应用 -webkit- 值,我使用:

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