Creating special paragraph styles ...................................................
Assume that you’re writing a Web page that contains special warning para-
graphs, and you want these warnings to stand out. In addition to making
them italic, you want the text to be a bright pumpkin color. To achieve this
effect, just define a paragraph style called warning(or whatever you want to
name it), and then add the italic and color specifications, like this:
<html>
<head>
<style>
p.warning {color: #ffcc33; font-style: italic;}
</style>
</head>
<body>
<p>An ordinary paragraph blah blah</p>
<p class=”warning”>
Warning: Wow! Here comes a whole bunch of gnats! What to do:
cover yourself and your loved ones with netting
and crouch down. Keep your mouth shut, too!
</p>
</body>
</html>
Calculating color ...............................................................................
How do you figure out that color #ffcc33 is pumpkin and not, say, brown, or
even an alarming color like fuchsia? When writing the previous CSS style, I
didn’t just guess the number #ffcc33, did I? After all, the possible color speci-
fications range from 000000 (black) up to ffffff (white). In between are (poten-
tially anyway) nearly 17 million colors. (For you sticklers, the precise number
is 16,777,216.) And what kind of number system uses letters of the alphabet
anyway? It must be pretty lame. (In fact, it is pretty lame, but computer pro-
grammers have been using this system for decades, so it’s going to take a
while yet to get rid of the monster.)
Some people are pretty color-sensitive, but no one is that sensitive. What
could be less descriptive of a color than a code like #ffcc33? You’ll never
remember that #ffcc33 produces pumpkin, or that #00ff00 gives you lime
green.