HTML Body Tag

An HTML body tag is simply a the word "body" bracketed by less than "<" and greater than ">" characters. Everything between the two HTML body tags <body> and <body> is part of the HTML body element. The HTML body is the the main part of the web page and the bulk of the web page where viewable information is stored. The HTML body is the part of the web page where elements containing content is placed such as paragraph elements, tables, forms, images, headers, and lists.

An example body section:

<h2 style="text-align: center">HTML Document Structure</h2>
This is a sample HTML body section.

The HTML body section is included inside the HTML tags such as <html> and </html>.

The BODY Element Tags and Attributes

The HTML body tags and attributes are:

  • <body> - Designates the start of the body.
    • ONLOAD - Used to specify the name of a script to run when the document is loaded.
    • ONUNLOAD - Used to specify the name of a script to run when the document exits.
    • BACKGROUND="clouds.gif" - (Depreciated) Defines the name of a file to use for the background for the page. The background can be specified as in the following line.

      <body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" alink="#FF0000" background="clouds.gif">

    • BGCOLOR="white" - (Depreciated) Designates the page background color. This attribute may be specified only when the "background" attribute is not used to specify a background image. The background image will override this designation if both are specified.
    • TEXT="black" - (Depreciated) Designates the color of the page's text.
    • LINK="blue" - (Depreciated) Designates the color of links that have not been visited.
    • ALINK="red" - (Depreciated) Designates the color of the link currently being visited.
    • VliNK="green" - (Depreciated) Designates the color of visited links.
  • </body> - Designates the end of the body.

In HTML documents that contain frames, the "body" element is required and must be inside the "noframes" element. The body element is required in HTML documents that do not contain frames.