Does the <html> element have a default margin or padding in any browser, since normalize.css doesn't reset it?

前端 未结 3 1614
天命终不由人
天命终不由人 2020-12-03 19:42

I\'m using normalize.css, and I saw that it doesn\'t reset margins or padding for the element. Since I assume they\'ve done their research I was wo

相关标签:
3条回答
  • 2020-12-03 20:13

    The <html> tag does not have any CSS rules automatically applied to it. You can apply styles if you like, but the only time I've ever done it is to get 100% height and width.

    Default styling for each browser:

    http://mxr.mozilla.org/mozilla-central/source/layout/style/html.css

    http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css

    http://www.iecss.com/

    0 讨论(0)
  • 2020-12-03 20:14

    No specification prevents browsers from having a default nonzero padding or margin on the html element. Neither does any specification require or even suggest such defaults, and browsers are not known to have them. On the other hand, if some browser vendor decides otherwise, they probably have a good reason to do so, and we had better not interfere unless we know what we are doing.

    So there is really no reason to reset padding and margin on the html element.

    0 讨论(0)
  • 2020-12-03 20:22

    With reference to http://www.w3.org/TR/CSS2/sample.html, no elements have default padding, but body, h1..h6, p, fieldset, form, ul, ol, dl, dir, menu, blockquote and dd have a margin by default

    0 讨论(0)
提交回复
热议问题