Sams Teach Yourself HTML and CSS in 24 Hours (7th Edition)
If none of the named colors imparts the exact hue you're after, you can mix your own custom colors by specifying how much red, green, and blue light should be mixed into each color. It works a little bit like Play-Dohjust mix in the amounts of red, blue, and green you want to get the appropriate color. The format is #rrggbb, in which rr, gg, and bb are two-digit hexadecimal values for the red, green, and blue components of the color. If you're not familiar with hexadecimal numbers, don't sweat it. Just remember that FF is the maximum and 00 is the minimum, and use one of the following codes for each component:
For example, bright red is #FF0000, dark green is #003300, bluish-purple is #660099, and medium-gray is #999999. To make a page with a red background and dark green text, the HTML code would look like the following: <body > Although the colors you specify in the <body> tag apply to all text on the page, you can also use either color names or hexadecimal color codes to change the color of a particular word or section of text by using the color style property in conjunction with the <span> tag. This is discussed in Hour 12.
You should be aware that different computer monitors may display colors in very different hues. I recently designed a page with a beautiful blue background for a client, only to find out later that the president of the company saw it on his computer as a lovely purple background! Neutral, earth-tone colors such as medium gray, tan, and ivory can lead to even more unpredictable results on many computer monitors, and may even seem to change color on one monitor depending on lighting conditions in the room and the time of day. The moral of the story: Consider sticking to the named colors unless you have precise control over your intended audience's computer displays or you're willing to test your page on various monitors. Of course, testing your pages on different computers is very important, and should be done anyway. |
Категории