< Body>的边距和填充标签 [英] Margin and Padding of <Body> Tag

查看:118
本文介绍了< Body>的边距和填充标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个非常简单的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> 

我对这种情况有一些疑问。


  1. 为什么这个值是4?

  2. 这个值来自哪里,它保存在哪里?

  3. 我们修改(可配置)这个默认值?

  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.

    1. Why this value is 4?
    2. From where this value is coming, is it saved somewhere?
    3. Can we modify (configurable) this default value?
    4. How these values are different for browsers?

    Thanks.

    解决方案

    1. First of all, it's probably 4px and not 4. Second, that's just the way the browser vendor decided should be the default.
    2. It is saved in the default browser stylesheets.
    3. You can, but you shouldn't. It differs with each browser. Google it! How do I change default stylesheet on <insert browser here>?
    4. 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.

    这篇关于&lt; Body&gt;的边距和填充标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆