attribute name | possible values | meaning |
---|---|---|
BGCOLOR | color specification | background color for the document |
TEXT | color specification | color for the text of the document |
LINK | color specification | color for unvisited hypertext links |
VLINK | color specification | color for visited hypertext links |
ALINK | color specification | color for active hypertext links; used to stroke the text for a link at the moment the user selects (e.g. clicks on) the link |
BACKGROUND | URL | URL for an image to be used to tile the background. |
All of these attributes are deprecated in HTML 4.0
The HTML element, which can be either implicit or explicit. Only one BODY element is allowed in a document, and it must appear after the document head (which can be implicit or explicit).
Headings, text elements, block elements, and ADDRESS elements.
In HTML 4.0 Strict, text elements may not occur directly within a BODY element but must be enclosed into e.g. a P element.
<BODY> <H1>Sample document</H1> <P> This is just a trivial sample document. Its body contains first a heading, then a paragraph, and nothing else. </P> </BODY>
<BODY BGCOLOR=AQUA TEXT="#848484" LINK=RED VLINK=PURPLE ALINK=GREEN > <H1>Sample document</H1> <P> This is also a trivial sample document. Its body contains first a heading, then a paragraph, and then a paragraph containing a link. However, the BODY element uses attributes to affect the visual rendering. </P> <P> This document was written by <A HREF="../">Jukka Korpela</A>. </P> </BODY>
<BODY TEXT=BLUE LINK=RED VLINK=BLUE ALINK=PINK BGCOLOR=WHITE BACKGROUND="wave.gif" > <H1>Sample document</H1> <P> This document contains first a heading, then a paragraph, and then a paragraph containing a link. However, the BODY element uses attributes to affect the visual rendering, including a background image. </P> <P> This document was written by <A HREF="../">Jukka Korpela</A>. </P> </BODY>
Be careful when playing with background images and colors. What looks cool on your screen might be disgusting on some other (or in someone else's opinion).
If you set some of the attributes BGCOLOR, TEXT, LINK, VLINK and ALINK, set them all. Otherwise e.g. your specified background color might coincide with user's default color for text. (See discussion of background in the Frequently Encountered Problems document by WDG.
Select the text color so that it works together with the background color or the colors of the background image. For instance, red on green can cause serious problems, because a significant number of people have difficulties in distinguishing them.
The text color can be affected locally by FONT elements with COLOR attribute. Background color cannot be set locally in HTML 3.2; if you want to use different backgrounds, you have to write separate HTML files (or use style sheets).
You can set both BGCOLOR and BACKGROUND. If you do, browsers typically give preference to BACKGROUND, but if the background image cannot be loaded, BGCOLOR is used.
For more information about backgrounds, see The background FAQ (though it is rather old and dusty).