# body

Specifies the body of the content of the document.

## Platform Support

IE | Netscape | Mozilla | Opera | Safari
--- | --- | --- | --- | ---
2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+

## Example

This example shows a body element with the background set to an image named "background.gif" and runs the "startup()" function from a linked JS file defined in the head of the document (not shown) when the body loads:

     <body background="images/background.gif" onload="startup();"> <p>Some text...</p> </body>

## Remarks

The <body></body> element is required in all HTML documents. When settting color, font, background properties, use CSS rules when possible, rather than setting them explicitly in the <body></body> tag.

## Attribute Detail

Attribute | IE | Netscape | Mozilla | Opera | Safari
--- | --- | --- | --- | --- | ---
accesskey [key]. Hot-key shortcut for the element. | 5.5+ | no | no | no | 1.0+
alink (body) [color | "transparent"]. Example values: Red, #FF0000 (#RRGGBB color code for "red"), etc. Specifies the color for active links in the document. Specify either a color name or RGB color. | 4.0+ |  | 1.0+ | 7.0+ | 1.0+
background [url]. Example values: "../images/blue-background.gif", etc. Specifies the URL for the background image for the document or element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
bgcolor [color | "transparent"]. Example values: Red, #FF0000 (#RRGGBB color code for "red"), etc. Specifies the background color for the document or element. Specify either a color name or RGB color. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
bgproperties (body) If set, specifies that the background image is fixed and will not scroll. | 4.0+ | no | no | no | 1.0+
bottommargin (body) [margin-width]. Example values: 10px, 5%, etc. Bottom margin for the body of the document. | 4.0+ | no | no | no | no
class [class-name]. Example values: header-class, list-element, etc. CSS class assigned to the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
contenteditable Specifies whether or not the content of the element is editable, or if the element inherits the value of this property from its parent. | 4.0+ | no | no | no | 1.0+
dir Direction of the element text. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
disabled Specifies whether or not the element is disabled. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
hidefocus Specifies whether the element shows a visual cue when it has focus. | 5.5+ | no | no | no | no
id [element-id] Unique identifier for the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
lang [language-code]. Example values: "en" (English), "fr" (French), "es" (Spanish), etc. Language code for the content of the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
language Script language for the element. | 3.0+ | 2.0+ | 1.0+ | no | 1.0+
leftmargin (body) [margin-width]. Example values: 10px, 5%, etc. Left margin for the body of the document. | 4.0+ | no | no | no | 1.0+
link (body) [color | "transparent"]. Example values: Red, #FF0000 (#RRGGBB color code for "red"), etc. Specifies the color for links in the document. Specify either a color name or RGB color. | 4.0+ |  | 1.0+ | 7.0+ | 1.0+
marginheight [number-of-pixels] Top and bottom margins (in pixels) for the document. | 4.0+ | 4.0+ | 1.0+ | 7.0+ | 1.0+
marginwidth [number-of-pixels] Left and right margins (in pixels) for the document. | 4.0+ | 4.0+ | 1.0+ | 7.0+ | 1.0+
nowrap If present, specifies that the element text should not wrap. | 2.0+ | 1.1+ | 1.0+ | 4.0+ | 1.0+
rightmargin (body) [margin-width]. Example values: 10px, 5%, etc. Right margin (in pixels) for the body of the document. | 4.0+ | no | no | no | no
scroll (body) Specifies whether or not scroll bars are visible. | 4.0+ | no | no | no | no
style [style-name] Inline style for the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
tabindex [number] Position of the element in the tabbing order for the document. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
text (body) [color | "transparent"]. Example values: Red, #FF0000 (#RRGGBB color code for "red"), etc. Specifies the color for text of the document. Specify either a color name or RGB color. | 4.0+ |  | 1.0+ | 7.0+ | 1.0+
title [text-description] Short text description for the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
unselectable Specifies whether or not the element is unselectable. | 5.5+ | no | no | no | no
vlink (body) [color | "transparent"]. Example values: Red, #FF0000 (#RRGGBB color code for "red"), etc. Specifies the color for visited links in the document. Specify either a color name or RGB color. | 4.0+ |  | 1.0+ | 7.0+ | 1.0+

## Event Detail

Event | IE | Netscape | Mozilla | Opera | Safari
--- | --- | --- | --- | --- | ---
onactivate Fires when the element becomes active. | 4.0+ | no | no | no | no
onafterprint Fires immediately after a user prints or print previews a document. | 4.0+ | no | no | no | no
onbeforeactivate Fires immediately before the element becomes active. | 4.0+ | no | no | no | no
onbeforecut Fires immediately before the selection is cut to the clipboard. | 4.0+ | no | no | no | 1.0+
onbeforedeactivate Fires immediately before the element stops being the active element. | 4.0+ | no | no | no | no
onbeforeeditfocus Fires immediately before the element receives focus prior to being edited. | 4.0+ | no | no | no | no
onbeforepaste Fires immediately before the selection is pasted from the clipboard to the element. | 4.0+ | no | no | no | 1.0+
onbeforeprint Fires immediately before a user prints or print previews a document. | 4.0+ | no | no | no | no
onbeforeunload Fires immediately before a document is unloaded. | 4.0+ | no | no | no | no
onclick Fires when the element is clicked. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
oncontextmenu Fires when the element is right-clicked and the context menu opens. | 4.0+ | no | no | no | 1.0+
oncontrolselect Fires immediately before the element is selected. | 4.0+ | no | no | no | no
oncut Fires when the element is cut to the clipboard. | 4.0+ | no | no | no | 1.0+
ondblclick Fires when the element is double-clicked. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
ondeactivate Fires when the active element becomes inactive. | 4.0+ | no | no | no | no
ondrag Fires when the element is dragged. | 4.0+ | no | no | no | 1.0+
ondragend Fires when the element is released from being dragged. | 4.0+ | no | no | no | 1.0+
ondragenter Fires when the element has another object dragged onto it that can be dropped on the element. | 4.0+ | no | no | no | 1.0+
ondragleave Fires when an element has an object dragged out of it that could be dropped onto the element. | 4.0+ | no | no | no | 1.0+
ondragover Fires when an element has an object dragged over it that could be dropped onto the element. | 4.0+ | no | no | no | 1.0+
ondragstart Fires immediately before an element is dragged. | 4.0+ | no | no | no | 1.0+
ondrop Fires when an object is dropped onto the element. | 4.0+ | no | no | no | 1.0+
onfilterchange Fires when the CSS Filter of an element changes or finishes transitioning. | 4.0+ | no | no | no | no
onfocusin Fires immediately before an element receives focus. | 4.0+ | no | no | no | no
onfocusout Fires immediately after focus moves from the element to another element. | 4.0+ | no | no | no | no
onkeydown Fires when a user presses down on a key while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
onkeypress Fires when a user presses a key or holds down the key while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
onkeyup Fires when a user releases a key while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
onload Fires when the content of the element finishes loading. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
onlosecapture Fires when the element loses mouse capture. | 4.0+ | no | no | no | no
onmousedown Fires when a user clicks down on the mouse button while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
onmouseenter Fires when the mouse pointer enters the element. | 4.0+ | no | no | no | no
onmouseleave Fires when the mouse pointer leaves the element. | 4.0+ | no | no | no | no
onmousemove Fires when the mouse moves while the pointer over the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
onmouseout Fires when the mouse pointer moves off of the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
onmouseover Fires when the mouse pointer moves over the element. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
onmouseup Fires when the user releases the mouse button while the element has focus. | 2.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+
onmousewheel Fires when the user rotates the mouse wheel while the element has focus. | 4.0+ | no | no | no | no
onmove Fires when the element moves. | 4.0+ | no | no | no | no
onmoveend Fires when the element stops moving. | 4.0+ | no | no | no | no
onmovestart Fires immediately before the element moves. | 4.0+ | no | no | no | no
onpaste Fires when the clipboard contents are pasted onto the element. | 4.0+ | no | no | no | 1.0+
onpropertychange Fires when one of the properties of the element changes. | 4.0+ | no | no | no | no
onreadystatechange Fires when the ready state of the element changes. | 4.0+ | no | no | no | no
onresize Fires immediately before an element is about to be resized. | 4.0+ | no | no | no | 1.0+
onresizeend Fires when the element is finished being resized. | 4.0+ | no | no | no | no
onresizestart Fires immediately before a user resizes the element. | 4.0+ | no | no | no | no
onscroll Fires when a user scrolls the element. | 4.0+ | no | no | no | 1.0+
onselectstart Fires immediately before the element is selected. | 4.0+ | no | no | no | 1.0+
onunload Fires when the content of the element finishes unloading. | 4.0+ | 1.0+ | 1.0+ | 4.0+ | 1.0+

## Availability

W3C HTML 4.01

text_html aptana_docs