Adding Color to a Web Page


HTML Tags Found in this section:

<BODY BGCOLOR=" "> Background Color

<BODY LINK="# "> Unviewed Links

<BODY TEXT=" "> Text Color

<BODY VLINK="# "> Viewed Links

<FONT COLOR= >

<BODY ALINK="#FF0000"> Active Links

<BODY BACKGROUND= " "> Background Image

Return to Topics Page


<BODY BGCOLOR=" ">

One way to make a web page more pleasing is adding a color or image background behind the text. To add a color to the background, use an attribute of the <BODY> tag known as BGCOLOR. Most newer browsers understand colors specified using English words such as black, blue, white, red, etc.

For a blue background add the following attribute to the <BODY BGCOLOR= " "> tag.

<BODY BGCOLOR="BLUE">

To get a more precise control of color, use Hexadecimal codes for the 256 colors that can be displayed on a web page.

The web page with the colors and color codes is:
http://www.phoenix.net/~jacobson/rgb.html

To return to a white background color use:

<BODY BGCOLOR="#FFFFFF">

Don't forget to include the # sign before the hex code.

top of page


<BODY TEXT=" "> Changing Text Color

To change the color of the text for an entire document use the tag: <BODY TEXT=" ">

In the space between the quotation marks, enter the color word such as red, blue, green, etc. or the Hexadecimal code for the 256 colors that can be displayed on a web page. Don't forget to include the # sign before the hex code.

For red text add the following attribute to the code to the <BODY TEXT=" "> tag.

<BODY TEXT="RED">

or

<BODY TEXT="#ff0000">

#ff0000 is the color code for red.


<FONT COLOR= >

To change some of the text in the HTML document to another color use the FONT COLOR Tag.

To change the color of the font to red add the following attribute to the code to the <FONT COLOR=" "> tag.

<FONT COLOR="RED">

or

<FONT COLOR="#ff0000"> </FONT>

#ff0000 is the color code for red.

 

Example:

<HTML>

<HEAD><TITLE>Body Background</TITLE></HEAD>

<BODY BGCOLOR="#FF0000">

<H1>This background is RED</H1>

<H1><FONT COLOR=white>The text is white</H1>

<H1><FONT COLOR="#FFFF99">The text is yellow</FONT></H1>

</BODY>

</HTML>

Click here to see the Web page

top of page


<BODY BACKGROUND= " "> Background Images

In addition to having a solid color, a graphic background can give the page greater distinction. Locate in the space between the quotation marks the name of the graphic to be used as the background image.

<Body Background= "graystars.gif"> tells the browser to get the graphic "graystars.gif" and place it on in the background of this web page

Go to the example web page that displays this background

 

Check this background site out for more free backgrounds:

The Background Archives - http://the-tech.mit.edu/KPT/bgs.html

top of page


Changing Colors of Links

<BODY LINK="#00FF00"> Unvisited Links

Unvisited link text has not linked to another location
To change the unvisited link color use: <BODY LINK="#00FF00">

Produces a page with blue links
- the color code #00FF00 is the code for blue.

To change the color of an unvisited link change the hex code in between the quotation marks. Don't forget to include the # sign before the hex code.

<BODY VLINK="#DB70DB"> Visited Links

Viewed Link the color the link changes to once it has been viewed
To change the Viewed link color use: <BODY VLINK="#DB70DB">

Produces a page with purple visited links
-the color code #DB70DB is the code for purple.

<BODY ALINK="#FF0000"> Active Links

Active Link the temporary color the link changes to when clicked upon
To change the active link color use: <BODY ALINK="#FF0000">

Produces a page with red links while the link is active
- the color code #FF0000 is the code for red.

Note:This changes the link(s) colors for the entire document.

 

Example:

Here are some links that have their color change

<BODY LINK="#009900" VLINK="#00DD00">

Check out the example web page:


A few tips on using color:

Keep in mind when using colors or images in your background is how easy it will be to read the text that is in front of it.

Busy backgrounds make the text difficult to read.

Dark text on dark backgrounds, and light text on light backgrounds are difficult to read.

Dark text on dark backgrounds, and light text on light backgrounds are difficult to read.

Keep the number of colors to a minimum. Too many colors will distract from the page.

top of page

 

7/14/98