htmlmargindocument-body

Is the default margin for <body> tag deprecated in html5


I have read in forums and in some old documentation, that there is a default on the body tag of 8px. But on This Site I read that all the default styling attributes of tag has been deprecated in .

But I found this default margin appearing in Firefox during an html5 practice session. Is it some specific issue with the browser, or it isn't deprecated?


Solution

  • Browsers have supported topmargin, leftmargin, etc as attributes you could add to the <body> start tag to control margins.

    These have never been part of any HTML specification. (If they had been, then they would have been deprecated in HTML 4). They are non-standard extensions to HTML introduced by browsers during the late '90s.

    HTML 5 marks then as non-conforming features (which is not the same as deprecated, but the document you found conflates the two states).

    The default stylesheet that browsers apply to HTML documents includes a margin for the body element. This is not deprecated (or mandated by any specification).