<body> Redirect 1

Summary

The HTML <body> element represents the content of an HTML document. There is 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 parent elements It must be the second element of an <html> element.
  • DOM interface HTMLBodyElement

Attributes

This element includes the global attributes.

Note: Starting in Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), background is no longer resolved as a URI; instead, it's treated as a simple string.
alink Deprecated since HTML4.01, Obsolete since HTML5; use CSS instead.
Color of text for hyperlinks when selected.
background Deprecated since HTML4.01, Obsolete since HTML5; use CSS instead.
URI of a image to use as a background.
bgcolor Deprecated since HTML4.01, Obsolete since HTML5; use CSS instead.
Background color for the document.
link Deprecated since HTML4.01, Obsolete since HTML5; use CSS instead.
Color of text for unvisited hypertext links.
onafterprint HTML5
Function to call after the user has printed the document.
onbeforeprint HTML5
Function to call when the user requests printing of the document.
onbeforeunload HTML5
Function to call when the document is about to be unloaded.
onblur HTML5
Function to call when the document loses focus.
onerror HTML5
Function to call when the document fails to load properly.
onfocus HTML5
Function to call when the document receives focus.
onhashchange HTML5
Function to call when the fragment identifier part (starting with the hash (#) character) of the document's current address has changed.
onload HTML5
Function to call when the document has finished loading.
onmessage HTML5
Function to call when the document has received a message.
onoffline HTML5
Function to call when network communication has failed.
ononline HTML5
Function to call when network communication has been restored.
onpopstate HTML5
Function to call when the user has navigated session history.
onredo HTML5
Function to call when the user has moved forward in undo transaction history.
onresize HTML5
Function to call when the document has been resized.
onstorage HTML5
Function to call when the storage area has changed.
onundo HTML5
Function to call when the user has moved backward in undo transaction history.
onunload HTML5
Function to call when the document is going away.
text Deprecated since HTML4.01, Obsolete since HTML5; use CSS instead.
Foreground color of text.
vlink Deprecated since HTML4.01, Obsolete since HTML5; use CSS instead.
Color of text for visited hypertext links.

Specifications

Specification Status Comment
WHATWG HTML Living Standard Living Standard  
HTML5 Candidate Recommendation  
HTML 4.01 Specification Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 (Yes) (Yes) (Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)

See also

Document Tags and Contributors

 Last updated by: Sheppy,