The <body> tag is the HTML tag which encompasses the visual parts of the document. It surrounds the text, images, tables, and other pretty things that make up your everyday web page. It is placed between the <html>...</html> tags of the document. In the HTML 4.01 standard, the W3C states that the body tag is optional. There is an ending tag for the body tag, </body>, which is optional as well. The body tag can not be used in nodes on everything2. It has a number of different attributes which can be included in the tag. These include:

background="URL" (Optional, Depreciated)
If included, this attribute specifies that the document has a background image. By default, the image is tiled in all directions across the page, but this can be overcome with Cascading Style Sheets, and the bgproperties attribute below. The actual image can be in a variety of different image formats, the most common including GIF, JPEG, and PNG, depending on browser support. The attribute accepts URLs in the form of either complete, partial or relative URLs for the image. If the image specified by URL is not found, the background image is ignored, and the bgcolor attribute, or the browsers' default background colour, is used for the background instead.

text="colour" (Optional, Depreciated)
This optional attribute specifies the colour of normal text on the entire web page. On most browsers and systems, this is usually black by default, however it can be changed by the user/user agent - so to make sure your web page looks the same on all systems, you need to specify a colour. The colour can be in either hexadecimal form (#rrggbb), or it can be one of the number of named colours available - see the Named HTML Colors superdoc for these.

link="colour", alink="colour", vlink="colour" (Optional, Depreciated)
These optional attributes specify various colours for links in the document. Links are created using the &kt;a> tag. The "link" attribute specifies the colour of normal, unvisited links in the document; the "vlink" attribute specifies the colour of visited (i.e. the user has visited the link's document already) links in the document; and the "alink" attribute specifies the colour of active links in the document, which occurs when the user clicks on the link (and waiting for the page to load). On most browsers and systems, the link colour is usually blue, the visited link purple and the active link red. It can be changed by the user/user agent however, so to make sure your web page looks the same on all systems, you need to specify a colour. The colour can be in either hexadecimal form (#rrggbb), or it can be one of the number of named colours available - see the Named HTML Colors superdoc for these.

bgcolor="colour" (Optional, Depreciated)
This optional attribute specifies the background colour of the body of the document. This attribute is ignored if you also have the background attribute above - the image supercedes the colour. On Internet Explorer, this is usually white; on Netscape, this is usually a light grey (silver). This colour can be changed by the user/user agent however - so to make sure your web page looks the same on all systems, you need to specify a colour. The colour can be in either hexadecimal form (#rrggbb), or it can be one of the number of named colours available - see the Named HTML Colors superdoc for these.

scroll="yes/no" (Optional)
This optional attribute tries to inform the users' browser whether or not to include scrollbars when rendering the web page. When the size of the web page is larger than the browsers' available rendering space, scrollbars are usually included to allow the user to scroll down to view the rest of the web page - this attribute can disable this function in newer browsers.

Internet Explorer also brought about its own proprietary attributes to HTML. These aren't in the W3C specification for HTML. The following attributes were introduced in Internet Explorer 4.0, and will work in any version since then:

leftmargin="pixels", rightmargin="pixels", topmargin="pixels", bottommargin="pixels" (Optional, Depreciated)
These attributes specify absolute positioning of the body of the web page in reference to the browser window. Each of these attributes specifies the left, right, top and bottom margins respectively, and is measured in pixels. These can be set to 0, which means that the web page is aligned to the edges of the window. Not all of these attributes have to be included at the same time.

bgproperties="FIXED" (Optional)
This attribute indicates to the browser that the background image of the page should be "fixed". When the user scrolls down a web page, the background image usually follows the scrolling; however, this attribute will keep the image fixed, and the image will not move when the user scrolls. It only has one value - FIXED. This only has an effect when the background attribute is included as well with the body tag.

Most of these attributes have become depreciated, as the new way of HTML relies solely on Cascading Style Sheets for web pages, to specify elements' colours, sizes and positions. However, these depreciated attributes can still be included (under Transitional and Loose document type definitions (DTDs)), so older browsers can still render web pages appropriately.

A few attributes have been implemented recently, and are therefore only available in recent browsers. These new attributes include:

title="text" (Optional)
This attribute is for informational purposes. If present, this indicates the element title of the body.

style="value", class="value" (Optional)
Both of these values are related to Cascading Style Sheets (CSS), which is beyond the scope of this node.

id="value" (Optional)
The id attribute sets a specific identification key to the document, so attributes of the body can later be accessed through DHTML and other scripting methods.

The following example of the body tag specifies that the page has a background image "images/someimage.gif", which is fixed to the background. If the image is not available, the background will become white. The text on the page is coloured yellow by default.

<body bgcolor="white" text="#ffff00" background="images/someimage.gif" bgproperties="FIXED">
...
</body>

It is important to note that this is not a fully comprehensive list of all the attributes and information available for the <body> tag, it is merely a guide. Specifically, it does not cover the event attributes (onLoad, onUnload, etc), or any of the Dynamic HTML (DHTML) scripting properties. For a more complete guide to the body tag, please visit the World Wide Web Consortium (http://www.w3c.org), which sets the standards for HTML.