16.2. Specifying Colors by Name
Colors can also be identified by one of 140 color names originally developed for the X Window System. The complete list appears in Table 16-2 (sorted alphabetically, with numerical values included) and Table 16-3 (grouped by hue). You can also view samples of each color at http://www.learningwebdesign.com/colornames.html.
To set the background color to a dark olive green using a color name, the complete HTML tag would look like this:
There are also one hundred variants of gray numbered 1 through 100. "Gray1" is the darkest; "gray100" is the lightest. The color we generally think of as "gray" is roughly equivalent to "gray75." Both spellings "gray" and "grey" are acceptable.
16.2.2. Color Name Cautions
There are several pitfalls to using color names instead of numerical color values:
Table 16-2. Color names with their numeric values
These color names shift to the nearest Mac system palette color when viewed on a Macintosh using any browser except Netscape Navigator 4.0 (which shifts it to the nearest web palette color).
Table 16-3. Web color names by hue
16.2.3. Coloring Page Elements
Table 16-4 lists the HTML elements for which you can specify a color. Each tag's use is further explained in Chapter 9, "Structural HTML Tags", Chapter 10, "Formatting Text", and Chapter 13, "Tables" of this book.
Table 16-4. Summary of HTML tags with color attributes
Similarly, color can be applied to elements on a web page using Cascading Style Sheet properties. The CSS1 properties that take color values are listed in Table 16-5.
Table 16-5. CSS1 properties for specifying color
Copyright © 2002 O'Reilly & Associates. All rights reserved.