HTML Tutorial


Lesson 3
Using Colors

You can change the color of a font by using the <font color=color> command:
<font color=red><b>RED</b></font> = RED
<font color=green><b>GREEN</b></font> = GREEN
<font color=blue><b>BLUE</b></font> = BLUE
<font color=black><b>BLACK</b></font> = BLACK
This works for a limited number of predefined colors.

Alternatively, you can use the <font color=#rrggbb> command. HTML creates colors by combining red, blue and green, the three primary colors when working in light. Each of these three colors receives a two digit hexadecimal number (00 through ff), allowing for 256 shades. Combining the six hexadecimal digits makes it possible to create over 16 million different colors.

The following list gives you the basic palette for colors in HTML. Mix them as you will:
<font color=#000000><b>BLACK</b></font> = BLACK
<font color=#0000ff><b>BLUE</b></font> = BLUE
<font color=#00ff00><b>GREEN</b></font> = GREEN
<font color=#00ffff><b>CYAN</b></font> = CYAN
<font color=#ff0000><b>RED</b></font> = RED
<font color=#ff00ff><b>MAGENTA</b></font> = MAGENTA
<font color=#ffff00><b>YELLOW</b></font> = YELLOW
<font color=#ffffff><b>WHITE</b></font> = WHITE
Obviously the white does not show on the white background. We will deal with background colors in Lesson 5.

HINT: If you see a font in a color you particularly like or want to use, view the source of the page and write down the six digits for that color.

You can combine the color and size commands as in this example:
<font color=#000000 size=+2><b>LARGE BLACK</b></font> = LARGE BLACK

LESSON 2 | HOME PAGE | LESSON 4

© Geo. McCalip 2001