Section 3
ADDING COLOR TO THE BODY
Colors can be specified two different ways in HTML documents.
Normally they are specified by a six digit hex number. It consists of
three sets of two digit hex numbers that represent how much Red, Green,
and Blue is to be displayed. Hex numbers use the characters of 0 to 9,
and A to F (which makes a total of 16, 0 thru F). The number 000000 would
represent black (no Red, no Green, no Blue). The number FFFFFF would be
white (full Red, Green, and Blue on). Just plain Red would be FF0000,
Green would be 00FF00, and Blue would be 0000FF. Changing the values for
the amount of Red, Green, and Blue allows several thousand possible colors.
However, not all web browsers support all of them. So you may need to do
some testing to see if your web page comes out with the colors you want.
Don't let all the hex stuff confuse you. Most web browsers also
support all of the basic colors (BLACK, WHITE, RED, GREEN, BLUE, YELLOW,
and a few more) directly by name. So, if you want to keep things simple,
try using just the color name (instead of the hex numbers). Note however,
that this may not work correctly with all web browsers either.
You can specify what Background, Text, Link, and Viewed Link colors
you want in the opening <BODY> tag. Here is an example:
<BODY BGCOLOR="BLACK" TEXT="WHITE" LINK="RED" VLINK="BLUE">
If you wanted to use the hex numbers, the above would be entered as:
<BODY BGCOLOR="#000000" TEXT="#FFFFFF" LINK="#FF0000" VLINK="#0000FF">
For some web browsers you can leave out the opening and closing quote
marks, but it is recommended that you use them for full compatability.
Also note that if you use the hex numbers you must include the number/pound
sign "#" before the hex number.
You do not have to enter all of the items shown. If you leave out
the BGCOLOR and TEXT sections the web browser will default to Black Text
on a White Background (or whatever the user's web browser default is).
If you leave out the LINK and/or VLINK sections the web browser will use
the colors that where set as defaults in its preferences option.
The LINK and VLINK are used for items you set up later on the web page
as Links to other things (such as another web page). When the user clicks
the mouse on one of these Links (to go to another web page for example) the
color will be the VLINK (Viewed Link) color when they come back to the web
page again later (if it is still in their web browsers cache). Some web
browsers also support ALINK (At Link) which would change the color of the
Link as soon as the user clicks on it, but only temporarily while the web
browser is retrieving the Linked item.
If you have a special Background file (GIF, JPG, etc.) that you would
like used as a background you would add that into the <BODY> tag like this:
<BODY BACKGROUND="myfile.gif" BGCOLOR="BLACK" TEXT="WHITE" LINK="RED"
VLINK="BLUE">
Please note that the filename must be entered exactly the same as it
was stored on the web server. That is, "MyFile.gif", "myFile.gif", and
"MYFILE.GIF" are all different. Most web servers usually store filenames
in lower case. So be sure to enter it here exactly as it is on the web
server you are using.
Here is the actual BODY Tag being used for this web page:
<BODY BACKGROUND="spacback.gif" BGCOLOR="BLACK" TEXT="YELLOW"
LINK="#6699FF" VLINK="#6699FF" ALINK="#FF0000">
[Previous Section]
[Table of Contents]
[Addendum]
[Milt's Micro Digest Home Page]
[Next Section]
The names Microsoft, Internet Explorer, Netscape, and others used in this document
are Trademarks, or Registered Trademarks of the companies represented.
E-mail questions, comments, or suggestions to: miltst@hotmail.com
© 1999 miltst@hotmail.com

(This page was last modified on: Monday, February 08, 1999)