As you’ve seen, one
way to add a splash of color to the black, gray, and white on your web pages is
to ad images. However, several HTML attributes enable you to change the colors
of the page itself, including changing the background color, changing the color
of the text and links, and adding spot color to individual characters.
In this section, you’ll learn how to make all these changes in
HTML 3.2.however,as is the case with most of the presentational attributes we’ve
covered thus far, color attributes are deprecated in HTML 4.01 in favor of
style sheets. You’ll learn more about the style sheet approach in lesson 9.
SPECIFYING COLORS
Before you can change the color of any part of an HTML page,
you have to know what color you’re going to change it to. You can specify
colors using the color extensions to HTML in two ways:
·
Using a hexadecimal number representing that
color
·
Using one of set of predefined color names.
The most flexible and widely supported method of specifying
a color is to use the numeric identifier. Most image – editing programs have
what’s called a color picker – a tool for choosing a single color from a range
of available colors. Some color pickers display the value of that color in RGB
form as three numbers representing the intensity of red, green, and blue in
that color, Each number is usually 0 to 255, with 0 0 0 being black and 255 255
255 being white. If you use one of these tools, you’ll have to convert the
decimal numbers to hexadecimal. These days, most tools with color bickers also
provide the hexadecimal values for red, green, and blue, which is what web
browsers require. In fact, the color picker that’s built into the Mac OS
includes the hexadecimal values to make things easy on web publishers.
The final hex number you need is all three numbers put
together with a hash sign (#) at the beginning, as in the following.