Back Main GuestBook Contact Music (JS) Appendix

<BODY></BODY> - The Document Body

This tag is used to indicate the body, or text, of an HTML document. Everything that will show up on the web page is part of this element.

This tag should be closed just before <HTML> by typing </BODY>.

HTML 4.0 Specification § 7.5.1

Attributes for <BODY>

  %coreattrs %i18n %events

Presentational Attributes

D background= [CS]
  • "__"
    [URI to image]
Specifies the image location.
This attribute tells the browser to tile the specified image as the document background.

D bgcolor= [CI]
Specifies the color in hexadecimal form.
Specifies the color by name.
This attribute controls the background color of the document.
If both the background and bgcolor attributes are set, the background attribute takes precedence.

D alink= [CI]
Specifies the color in hexadecimal form.
Specifies the color by name.
This attribute controls the text color for active links.

D link= [CI]
Specifies the color in hexadecimal form.
Specifies the color by name.
This attribute controls the text color of unvisited links.

D vlink= [CI]
Specifies the color in hexadecimal form.
Specifies the color by name.
This attribute controls the color of visited links.

D text= [CI]
Specifies the color in hexadecimal form.
Specifies the color by name.
This attribute controls the color of the regular text in the HTML document.

Attributes for Scripting

  onload= [CI]
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script when the document loads.
You must specify a default scripting language!

  onunload= [CI]
  • "__"
    [script]
Gives the script commands in the document's default scripting language.
This attribute tells the browser to execute the specified script when the document is removed from the window/frame.
You must specify a default scripting language!

Here is a sample HTML page:

Sample Page


Here is the code for the sample above:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>
All About Violets *\*/*
</TITLE>
<STYLE type="text/css">
<!-- H1 {color: #800080} -->
</STYLE>
</HEAD>
<BODY bgcolor="#FFFFFF" link="#FF0000" alink="#FF00FF" vlink="#0000FF" text="#006600">
<H1>All About Violets</H1>
<p>The beautiful wild violets that decorate lawns... blah, blah, blah...</p>
</BODY>
</HTML>

This will produce a page in which all unvisited links are red (FF0000), all active links are fuchsia (FF00FF), and all visited links are blue (0000FF). The document's text will be dark green (006600) on a white (FFFFFF) background.

Using bgcolor="white" link="red" alink="fuchsia" vlink="blue" would produce the same result. However, I cannot substitute "green" for "#006600" in text, because "green" stands for a different shade of green than "#006600". Using the RGB triplets gives you much greater freedom.