In W3 CSS and also in XUL/CSS? (not between CSS and XUL/CSS).
在W3 CSS和XUL / CSS中? (不在CSS和XUL / CSS之间)。
5 个解决方案
#1
8
Padding is the space INSIDE an element (inside the border of the element).
填充是INSIDE元素的空间(在元素的边界内)。
Margin is the space OUTSIDE(Around) an element.
边距是OUTSIDE(周围)的一个元素。
#2
21
I recommend this article for you. The diagram is from that article.
我推荐这篇文章给你。该图来自该文章。
#3
2
Padding is the area between the content and the border while the margin is the area outside the border.
填充是内容和边界之间的区域,而边距是边界外的区域。
See CSS box model for clarification.
有关说明,请参阅CSS框模型。
#4
1
OK, several of these answers use confusing terminology and are wrong.
好的,其中一些答案使用了令人困惑的术语而且是错误的。
The css width of an element does not include padding, borders, or margin.
元素的css宽度不包括填充,边框或边距。
Therefore it is imprecise to say "padding is inside an element".
因此,说“填充在元素内”是不精确的。
It is correct to say "padding is inside the border of an element" and "margin is outside the border of an element".
说“填充在元素的边界内”和“边距在元素的边界之外”是正确的。
To calculate how much space a box takes up (for example, just horizontally):
要计算一个框占用的空间(例如,只是水平):
horiz. space = width + 2(padding) + 2(border) + 2(margin)
It bugs me when people say "padding is space inside an element" because: the element has padding, it has a border, and it has margin. All of that stuff is outside the content width of the element, and must be accounted for when calculating how much space the element takes up.
当人们说“填充是元素中的空间”时,它会让我感到困惑,因为:元素有填充,它有边框,并且有边距。所有这些东西都在元素的内容宽度之外,并且在计算元素占用的空间时必须考虑到这些。
If you say "padding is inside the element" then you are making the same mistake MSIE did in its broken box model, causing untold web designers many headaches.
如果你说“填充在元素内部”那么你就会在其破碎的盒子模型中犯下同样的错误,导致无数网页设计师头疼。
http://www.456bereastreet.com/archive/200612/internet_explorer_and_the_css_box_model/
#5
0
padding is part of the width of an element. margin is outside and isn't part of the width
padding是元素宽度的一部分。保证金在外面,不是宽度的一部分
Here's an interesting box model demo that will help you understand.
这是一个有趣的盒子模型演示,可以帮助您理解。
#1
8
Padding is the space INSIDE an element (inside the border of the element).
填充是INSIDE元素的空间(在元素的边界内)。
Margin is the space OUTSIDE(Around) an element.
边距是OUTSIDE(周围)的一个元素。
#2
21
I recommend this article for you. The diagram is from that article.
我推荐这篇文章给你。该图来自该文章。
#3
2
Padding is the area between the content and the border while the margin is the area outside the border.
填充是内容和边界之间的区域,而边距是边界外的区域。
See CSS box model for clarification.
有关说明,请参阅CSS框模型。
#4
1
OK, several of these answers use confusing terminology and are wrong.
好的,其中一些答案使用了令人困惑的术语而且是错误的。
The css width of an element does not include padding, borders, or margin.
元素的css宽度不包括填充,边框或边距。
Therefore it is imprecise to say "padding is inside an element".
因此,说“填充在元素内”是不精确的。
It is correct to say "padding is inside the border of an element" and "margin is outside the border of an element".
说“填充在元素的边界内”和“边距在元素的边界之外”是正确的。
To calculate how much space a box takes up (for example, just horizontally):
要计算一个框占用的空间(例如,只是水平):
horiz. space = width + 2(padding) + 2(border) + 2(margin)
It bugs me when people say "padding is space inside an element" because: the element has padding, it has a border, and it has margin. All of that stuff is outside the content width of the element, and must be accounted for when calculating how much space the element takes up.
当人们说“填充是元素中的空间”时,它会让我感到困惑,因为:元素有填充,它有边框,并且有边距。所有这些东西都在元素的内容宽度之外,并且在计算元素占用的空间时必须考虑到这些。
If you say "padding is inside the element" then you are making the same mistake MSIE did in its broken box model, causing untold web designers many headaches.
如果你说“填充在元素内部”那么你就会在其破碎的盒子模型中犯下同样的错误,导致无数网页设计师头疼。
http://www.456bereastreet.com/archive/200612/internet_explorer_and_the_css_box_model/
#5
0
padding is part of the width of an element. margin is outside and isn't part of the width
padding是元素宽度的一部分。保证金在外面,不是宽度的一部分
Here's an interesting box model demo that will help you understand.
这是一个有趣的盒子模型演示,可以帮助您理解。