The HTML <body>
Element represents the content of an HTML document. There can be only one <body>
element in a document.
Content categories | Sectioning root. |
---|---|
Permitted content | Flow content. |
Tag omission | The start tag may be omitted if the first thing inside it is not a space character, comment, <script> element or <style> element. The end tag may be omitted if the body element has contents or has a start tag, and is not immediately followed by a comment. |
Permitted parents | It must be the second element of an <html> element. |
Permitted ARIA roles | None |
DOM interface |
HTMLBodyElement
|
This element includes the global attributes.
alink
deletedcolor
property in conjunction with the :active
pseudo-class instead.
background
deletedbackground
property on the element instead.
bgcolor
deletedbackground-color
property on the element instead.
bottommargin
deletedmargin-bottom
property on the element instead.
leftmargin
deletedmargin-left
property on the element instead.
link
deletedcolor
property in conjunction with the :link
pseudo-class instead.
onafterprint
onbeforeprint
onbeforeunload
onblur
onerror
onfocus
onhashchange
'#'
) character) of the document's current address has changed.onlanguagechange
onload
onmessage
onoffline
ononline
onpopstate
onredo
onresize
onstorage
onundo
onunload
rightmargin
deletedmargin-right
property on the element instead.
text
deletedcolor
property on the element instead.
topmargin
deletedmargin-top
property on the element instead.
vlink
deletedcolor
property in conjunction with the :visited
pseudo-class instead.
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of '<body>' in that specification. | Living Standard | Changed the list of non-conforming features. |
HTML5 The definition of '<body>' in that specification. | Recommendation | Obsoleted the formerly deprecated attributes. Defined the behavior of the non-conforming and never standardized margintop , marginleft , marginright and marginbottom . Added the on* attributes. |
HTML 4.01 Specification The definition of '<body>' in that specification. | Recommendation | Deprecated the alink , background , bgcolor , link , text and vlink attributes. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 1.0 | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
onlanguagechange | ? | ? | 32 (32) | ? | ? | ? |
bottommargin , leftmargin , rightmargin , topmargin deleted | (Yes) | ? | 35 (35) [1] | ? | ? | ? |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
onlanguagechange | ? | ? | 32.0 (32) | ? | ? | ? |
bottommargin , leftmargin , rightmargin , topmargin deleted | (Yes) | ? | 35.0 (35) [1] | ? | ? | ? |
[1] Was supported before this in Quirk Mode only.
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body