The body element (<body>) represents the main content of the document.
Overview TableYou can access the <body>
element from script through the document object.
The window object for the <body>
element can host event handlers for the onblur
, onfocus
, onload
, or onunload
events.
onafterprint
User printed current document. onbeforeprint
User requested printing of current document. onbeforeunload
Document is about to be unloaded. onblur
Document lost focus. onerror
Document failed to load properly. onfocus
Document received focus. onhashchange
Fragment identifier part of the document’s current address changed. onload
Document finished loading. onmessage
Document received a message. onoffline
Network connections failed. ononline
Network connections returned. onpopstate
User navigated session history. onredo
User went forward in undo transaction history. onresize
Document view was resized. onstorage
Storage area changed. onundo
User went backward in undo transaction history. onunload
Document is going away.
The following attributes are obsolete, and should not be used by authors: alink
, bgcolor
, link
, marginbottom
, marginheight
, marginleft
, marginright
, margintop
, marginwidth
, text
, vlink
.
The <body>
element follows the <head>
element and is contained by the <html>
element.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML Document</title>
</head>
<body>
<p>The HTML content</p>
</body>
</html>
[View live example](http://test.w3.org/html/examples/elements/body/body01.html)
This example exposes the <body>
element in javascript.
var oBody = document.body;
Related specifications
Microsoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4