< Body>的边距和填充标签 [英] Margin and Padding of <Body> Tag
问题描述
我正在编写一个非常简单的HTML代码,下面列出了它。写在记事本中,并在IE-8和Firefox(OS:Window Vista)中打开。
< html>
< body>
< table border =1>< tr>< td> test< / td>< / tr>< / table>
< / body>
< / html>
上面的代码没有什么特别之处,它从左上角创建一些空间。 p>
通过使用下面的代码可以很容易地删除它:
< body style =margin: 0;填充:0>
现在我已经找到了默认的margin和padding,它是 4
用于Firefox,而IE-8则不同。
< body style =margin:4; padding:4>
我对这种情况有一些疑问。
- 为什么这个值是4?
- 这个值来自哪里,它保存在哪里?
- 我们修改(可配置)这个默认值?
- 浏览器的这些值如何不同?
感谢。
4px
而不是 4
。其次,浏览器供应商认为应该是默认设置。
如何在<在此处插入浏览器>?
这种差异是我们作为设计师使用CSS重置的主要原因之一,来规范所有遵循不同浏览器实现的CSS尴尬。
I am writing a very simple HTML code which is listed below. Written in notepad and opening in IE-8 and Firefox (OS: Window Vista).
<html>
<body>
<table border="1"><tr><td>test</td></tr></table>
</body>
</html>
There is nothing special in the above code, It is creating some space from top left corner.
Which can be easily removed by using the following code
<body style="margin:0; padding:0">
Now i have find out the default margin and padding, which is 4
for Firefox and different for IE-8.
<body style="margin:4; padding:4">
I have some question on this scenario.
- Why this value is 4?
- From where this value is coming, is it saved somewhere?
- Can we modify (configurable) this default value?
- How these values are different for browsers?
Thanks.
- First of all, it's probably
4px
and not4
. Second, that's just the way the browser vendor decided should be the default. - It is saved in the default browser stylesheets.
- You can, but you shouldn't. It differs with each browser. Google it!
How do I change default stylesheet on <insert browser here>?
- There probably are slight differences, you should be able to tell... by looking at the default stylesheets :)
That difference is one of the main reasons we as designers use a CSS reset, to normalize all of the CSS awkwardness that follows different browser implementations.
这篇关于< Body>的边距和填充标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!