Color: HTML:
Changing Color

Background Color

Text Color

Background Color To change the background color of an  entire  web page, use the BGCOLOR attribute in the opening <BODY> tag.

The value of the attribute is expressed in the hexadecimal equivalent of the red/green/blue values of the specified color.

When you change the background color on a web page, your opening body tag will be:

<BODY BGCOLOR="#[rrggbb]"> where [rrggbb] is the hexadecimal equivalent of the red/green/blue values of the specified color.

Note the use of both the pound sign and the quotation marks in the VALUE.

Text Color To change the color of all of the text on a page, use the TEXT attribute in the opening <BODY> tag.

Thus, a page with a hunter green background and white type would have the following opening body tag:

<BODY BGCOLOR="#336633" TEXT ="#ffffff">
You can also change the colors of the hyperlinks on a page.
  • LINK is the attribute that sets the hyperlink color.
  • VLINK is the attribute that sets the color of a hyperlink after it has been visited.
  • ALINK is the attribute that sets the color of the hyperlink as it is activated.

All of these attributes are placed in the opening <BODY> tag along with the values for the desired colors.

Thus if you want to change the background color to hunter green, the text color to white, the hyperlink color to orange, the visited hyperlink color to red, and the active hyperlink color to black, your body tag would look like this:
<BODY BGCOLOR="#336633" TEXT="#ffffff" LINK="#ffcc66" VLINK="#ff0000" ALINK="#000000">
Remember that rrggbb stands for the hexadecimal equivalents for the amounts of red, green, and blue in your chosen colors.

Color: HTML
Key Concepts
Changing Color

 

Personal Home PageWeb Design CenterTutorial MenuTop of Page

Web Design Center
Last Revised: October 19, 2006
© Agatha Taormina