
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Guide to the HTML Body Tag</title>
<META Name="description" lang="en" Content="A guide to understanding  the body tag used in hypertext markup language (HTML). This  handout explains the elements used in the body tag and provides  examples and links to resources on color and backgrounds.">
<META Name="keywords" Content="HTML body tag, understanding the HTML body tag, learning about the body tag guide to the body tag">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK REL="stylesheet" TYPE="text/css" HREF="/styles/standard.css">
</head>
<body>
<div align=center><p><br>
<table class="tableborder" width="600" border="0" cellspacing="0"
cellpadding="20">
<tr>
<td>
<!--#include virtual="/inc/top.html" -->
<p>
<!--  end header  -->



<!-- start here to copy sectional path nav -->
<hr align="left" width="70%">
<a href="../index.html">Handouts</a> &#187;
<a href="index.html">HTML Handouts</a> &#187;
The HTML Body Tag
<hr align="left" width="70%">
<P>
<!--   end sectional nav  -->



<h1>The HTML Body Tag</h1>




<p><br>


Referring to the <a href="htstart.html">handout on HTML</a>,
the body tag is present in every web
page.
On the one hand it is possible to have an extremely plain and
simple body tag, like this:  <b>&lt;body&gt;</b>. This plain
body tag will cause the look of your web pages to default to the
settings of the visitor's web browser.
<p>
A better approach is to choose your own colors and background image.
The colors you are able to choose include the beginning color
of the page and the colors of the regular text, and all the link
colors: visited link, UNvisited link and active link (the active
links is a really cheap thrill - it is the color that flashes as
you click on the link!)
<p><br>

<h2>Setting up text and background colors</h2>

The initial commands for colors are placed in the body tag. <strong>Do Not
create a second body tag</strong>; you should edit your existing body tag.
The strange numbers in this command, that appear in quote marks and begin
with a # (pound sign) are used to identify specific colors. You can use
the sites linked to the next section to choose the colors you want to use,
and to identify the correct number.

Format your body tag to look like this (remember it doesn't matter
whether you type the HTML tags (commands) in upper case, lower case
or mixed case. I recommend you use lower case):

<pre>
     &lt;body
       bgcolor="#ffffff"
       background="wh-paper.jpg"
       text="#000000"
       link ="#0000FF"
       vlink="#FF0000"
       alink="#ffff00"&gt;</pre>
       <p>
What do all those commands mean?
<dl>


<dt><B>&lt;body</B>

<dd>This is the beginning of the body tag. Notice the greater then sign
that used to end the tag is gone. It's been moved down to the last to enclose all
of these added commands.

<p>
<dt><B>bgcolor="#ffffff"</B>
   <dd>The bgcolor command sets a smooth color background. Sometimes this
is all you want and you won't want a background gif at all. The number
entry is a combination of the basic red,green,blue colors to produce a
color. If you choose to also have a background graphic you should choose a
bgcolor that complements the primary color of the background graphic. (see
more about this under background, next). Notice the number must be in
quotation marks, and that it must begin with a # (pound sign).

<p>
<dt><B>background="wh-paper.jpg"</B>
   <dd>This command places a background graphic on your page, underlying
all of the text and images you place there. Be sure to carefully select a
bgcolor to be placed under this graphic. This helps support text and
link colors you choose. When a person with a graphics browser visits your
page they'll see the background, NOT the bgcolor. BUT if the person has
graphics turned off, they'll see the bgcolor. Because of this you must be
sure this bgcolor is harmonious with the other colors you choose for the
page.

<p>
<dt><B>text="#000000"</B>
  <dd>This command sets the default color of plain text on the page. You
	can change the text color at any point on the page with the command
	&lt;font color="#999999"&gt; and entering the &lt;/font&gt; command to
	turn off the temporary color and return to the default set in the body
	tag.


<p>
<dt><B>link ="#0000FF"</B>
  <dd>The link color refers to links you <strong>have not yet
visited</strong>.


<p>
<dt><B>vlink="#FF0000"</B>
  <dd>The vlink refers to links you <strong>have</strong> visited.


<p>
<dt><B>alink="#ffff00"&gt;</B>
  <dd>The alink refers to an <strong>active</strong> link. A link is
"active"
for
that brief moment when you are actually clicking on the link. It will flash
this color for a fraction of a second, before it begins making the connection
to the link.

<p>
<dt><B>Notice the &gt; at the end of the alink</B>
  <dd>You can enter these commands in any order you wish. But the last entry
must end with the &gt; which serves to "close" the body tag.
</dl>

<p><br>
<h2>Resources for Choosing Color Settings</h2>

The Netscape Composer had a good color picker built right into
<B>Format/Page Colors and Properties</B>.
O'Reilly offers a list of
<a
href="http://www.oreilly.com/catalog/wdnut/excerpt/color_names.html">colors
by name</a> that you can use without those strange hex numbers! OR
you can try a web-based resource. <p>
There's an excellent resource for picking out colors for the bgcolor
and link colors. This
<a href="http://www.bagism.com/colormaker/">ColorMaker</a>
offers a grid of color for setting background colors and link colors.
<ol>
<li>At the ColorMaker page, click on the <B>Colors</B> button.
<li>Next to the <B>Element</B> heading is a pick list on which you
can select which element you want to pick a color for - bgcolor or
the various link colors.
<li>As you choose colors you will see format in the right-hand
frame so you can see how all the colors work together.
<li>Once you have all the settings you want, select the
 <B>copy the BODY tag</B> link in the right-hand frame to display
 the complete body tag.
</ol>

<p><br>
<h2>Resources for Background Images</h2>
<ul>

<li><a href="http://windyweb.com/">Wendy Web</a> offers a large
range of beautiful backgrounds as well as other graphics.

<li>These <a
href="http://members.aol.com/htmlataglance/pastels.htm">Light
background colors</a> are among my favorite.
</ul> <p>




<!-- footer -->
<!--#include virtual="/inc/foot.html" -->
<p>
</td></tr></table>
</div>
<!--#exec cgi="/cgi-bin/looker/ax.pl" -->
</body>
</html>