HTML 3.2 and Netscape 3.0: The BODY Element | WebReference

HTML 3.2 and Netscape 3.0: The BODY Element

prevtopnext

The BODY Element

HTML 3.2 and Netscape 3.0


The <BODY> element surrounds the visible contents of the document. It occurs immediately after the closing </HEAD> tag. In HTML 3.2 the BODY tag is optional, but it is safer to include it for the sake of older browsers. Only one BODY tag is allowed within a document.

HTML 3.2 now includes background and text colors in the BODY tag. Netscape 2.0+ and Explorer 2.0+ support these attributes so most (80-90%) of the Web can now utilize these Netscape-invented attributes. Colors are given in RGB as hexadecimal numbers (e.g. "#ccff00") or as one of 16 color names:

aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow

NHTML: Netscape can recognize 256 named colors.

Note that global text colors are superseded by local (<FONT COLOR="RED">) text colors. BGCOLOR is faster to display than a graphic BACKGROUND and should be used for solid color backgrounds. Not all color combinations are easily to read, so choose your combinations wisely.

The HTML 3.2 draft does not currently include style sheets, these will be included in a future version (Cougar). Style sheets handle document appearance (through the LINK element).

Attributes

BACKGROUND
The BACKGROUND attribute tiles the background with the referenced graphic, with the subsequent HTML overlaying this graphic. The smaller the file size of your background graphic the faster it will initially load, but the larger its physical size the faster it will display. Therefore for a given speed computer (say a 486 with a 14.4 Kbps modem) there's an optimum size background graphic that will display in the least amount of time. We use long rectangular (700 X 16 pixels) background gifs under 1K in file size, all white or two color. Interlacing slows down the display considerably and should not be used. Background graphics will not animate (GIF89a).

You should ensure that the text displayed over your background is easily readable. To do this ensure that the contrast in your graphic is uniformly low and set a text color if you supply a background, as this is the only way to ensure contrasting colors. Optimize the size of your background graphics, I've seen some over .5 MB. Now, where was that Enhanced for Netscape Hall of Shame... Ex:

<BODY BACKGROUND="bg_twotone.gif" ...>

BGCOLOR
The BGCOLOR attribute defines a background color for the document. Colors in HTML 3.2 are given in RGB as hexadecimal, or using one of 16 named colors in the form ATTRIBUTE="#rrggbb." Note that background colors will dither if they are outside of the 216-color palette common to Macs and 8-bit PCs (see Optimizing Web Graphics for more details). Ex:

<BODY BGCOLOR="#ffffff" ...>

LINK
The LINK attribute defines the text color for hypertext links. Ex:

<BODY BGCOLOR="#ffffff" LINK="#ff0000"...>

ALINK
The ALINK attribute defines the text color for an "active link," i.e., the color that flashes briefly when a text link is selected. Ex:

<BODY BGCOLOR="#ffffff" ALINK="#ffff00" LINK="#ff0000" ...>

VLINK
The VLINK attribute defines the text color for a "visited link." Ex:

<BODY BGCOLOR="#ffffff" VLINK="#0000ff" ...>

Putting it all together yields:

<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#ff0000" VLINK="#0000ff" ALINK="#ffff00">

This BODY tag instructs the browser to render the document with a white background, black text, red links, blue visited links, and to flash yellow when a link is clicked.

Usage

<BODY BGCOLOR=XXXXX TEXT=XXXXX> - WRONG (no # or quotes)
<BODY BGCOLOR="YYYYYY"><BODY BGCOLOR="ZZZZZ">
<BODY BGCOLOR="YYYYZZ"><BODY BGCOLOR="ZZZZZ"> ad infinitum - WAY WRONG

<BODY BACKGROUND="art/bg_paper.jpg" TEXT="#000000"...> - RIGHT
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#ff0000" VLINK="#0000ff" ALINK="#ffff00"> - RIGHT (note we use quotes here, see source code of this document for an example)


nextprev

Comments are welcome

 


Revised: Aug. 30, 1996

URL: https://webreference.com/html3andns/body.html