This wiki has been archived and is now read-only.


From HTML Wiki
Jump to: navigation, search


The <body> element represents the main content of the document.

HTML Attributes

  • onafterprint = string
    User printed current document.

  • onbeforeprint = string
    User requested printing of current document.

  • onbeforeunload = string
    Document is about to be unloaded.

  • onblur = string
    Document lost focus.

  • onerror = string
    Document failed to load properly.

  • onfocus = string
    Document received focus.

  • onhashchange = string
    Fragment identifier part of the document’s current address changed.

  • onload = string
    Document finished loading.

  • onmessage = string
    Document received a message.

  • onoffline = string
    Network connections failed.

  • ononline = string
    Network connections returned.

  • onpopstate = string
    User navigated session history.

  • onredo = string
    User went forward in undo transaction history.

  • onresize = string
    Document view was resized.

  • onstorage = string
    Storage area changed.

  • onundo = string
    User went backward in undo transaction history.

  • onunload = string
    Document is going away.

See also global attributes.


Example A

[try it]

<!doctype html>
<html lang=en>
<meta charset=utf-8>
<title>The HTML Document</title>
<p>The HTML content</p>

HTML Reference

The HTML5 specification defines the <body> element in 4.4.1 The body element.