The HTML body element will define the rest of the HTML page which is the bulk of your document. It will include headers, paragraphs, lists, tables, and more. These elements are described fully in the rest of this document.
An example body section:
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF"
<h1 style="text-align: center">HTML Document Structure</h1>
This is a sample HTML file.
The above example is similar to the body section in the example in the "HTML Document Structure" section with the exception that this example controls the body background, wallpaper, and link color directly rather than using style sheets. As you can see below many of the attributes to control the BODY are depreciated in favor of style sheet use.
The BODY Element Tags and Attributes
The <body> tag is used to start the BODY element and the </body> tag ends it. It is used to divide a web page within one or more sections. Its tags and attributes are:
- <body> - Designates the start of the body.
- </body> - Designates the end of the body.
For the depreciated attributes noted above, see the "Setting document style" section for an example of how to set the same attributes using a style sheet. If the colors are defined with "#FFFFFF" as done in the above example, the values indicate the intensity of the colors, red, green, and blue in hexadecimal. The leftmost two "FF" indicate the strength of the color red, the center indicates the strength of the color green, and the rightmost two indicate the strength of the color blue. The values may be a hexadecimal value from 0 through FF which in decimal is 0 through 255. The highest value being the highest strength of the respective color. This format is "RRGGBB". You can also specify the color with one of the following standard colors.
- magenta or fuschia
- cyan or aqua
Setting a background image on the page
To set up a background on the web page use a BODY statement with the BACKGROUND attribute defined as follows:
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#000080" alink="#FF0000" background="clouds.gif">
This method is depreciated and authors are encouraged to use style sheets.