问题
I'm using normalize.css, and I saw that it doesn't reset margins or padding for the <html>
element. Since I assume they've done their research I was wondering: does the <html>
element have a default margin or padding in any browser? Is it right of me to assume that it doesn't and that this is why normalize.css doesn't reset it?
回答1:
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/
回答2:
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
回答3:
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.
来源:https://stackoverflow.com/questions/19101486/does-the-html-element-have-a-default-margin-or-padding-in-any-browser-since-n