Using Colors in a Web Page


Introduction | Text | Images | Links | Colors | Tables | Resources

Web-Safe Colors

There are 216 standard "web-safe" colors that can be used reliably in all browsers. The colors are defined by a six digit hexadecimal code. Here are a few examples:
hex code common name
#000000 black
#FFFFFF white
#FF0000 red
#0000FF blue
#00FF00 green
#FFFF00 yellow
#FF00FF magenta
#00FFFF cyan

The complete table of web-safe colors and their codes can be found at Tufts Web Central site.

Colors are used at various places on an HTML document. Here are a few examples:

Set the font color to a specific color <FONT COLOR="#000000">This text will appear black</FONT>
Set the background color for an entire page <BODY BGCOLOR="#000000">
Set the default font color for an entire page <BODY TEXT="#000000">
Set the color for links on an entire page <BODY LINK="#000000">
Set the color for visited links on an entire page <BODY VLINK="#000000">
Set the color for text, links, visited links, and background for an entire page <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FFFF00" VLINK="#00FFFF">

Exercise 5

  1. In the BODY tag, add attributes so that your page has a background color and a default font color of your choice.
  2. Change the color of a word within your page to a color that is different from default.
  3. Save index.html.

Introduction | Text | Images | Links | Colors | Tables | Resources
© June 2001 | Thermal Analysis of Materials Processing Laboratory
Tufts University Medford, MA 02155 | Contact: Haruna Tada