HTML: The Markup Language

bodydocument body # T

The body element represents the body of a document (as opposed to the document’s metadata).

Permitted content #

Permitted attributes #

Descriptions for attributes specific to this element #

onafterprint = string
onbeforeprint = string
onbeforeunload = string
onhashchange = string
onmessage = string
onoffline = string
ononline = string
onpopstate = string
onredo = string
onresize = string
onstorage = string
onundo = string
onunload = string

Additional constraints and admonitions #

Tag omission #

A body element’s start tag may be omitted if the first thing inside the body element is not a space character or a comment, except if the first thing inside the body element is a script or style element.

A body element’s end tag may be omitted if the body element is not immediately followed by a comment and the element is either not empty or its start tag has not been omitted.

Permitted parent elements #

html

DOM interface #

interface HTMLBodyElement : HTMLElement {
           attribute Function onafterprint;
           attribute Function onbeforeprint;
           attribute Function onbeforeunload;
           attribute Function onblur;
           attribute Function onerror;
           attribute Function onfocus;
           attribute Function onhashchange;
           attribute Function onload;
           attribute Function onmessage;
           attribute Function onoffline;
           attribute Function ononline;
           attribute Function onpopstate;
           attribute Function onpagehide;
           attribute Function onpageshow;
           attribute Function onredo;
           attribute Function onresize;
           attribute Function onstorage;
           attribute Function onundo;
           attribute Function onunload;
};

Typical default display properties #

body {
display: block;
margin: 8px; }
body:focus {
outline: none; }