Specifying Color

You specify the color aspect of a style like this:

color: color-name;

Examples:

color: red;
color: #99ff99;

The word color is called the property, and the color name is the value for that property. Together, they make up a style specifier. Now we will put this style specifier into an appropriate HTML tag. The tag that's going to do the job the best is the <span> tag. This tag means “mark off a section of text.” In the example below, we've put <span> tags around the sections of text that are going to become colored.

These shirts come in
<span>hot red</span>
and <span>pastel green</span>.

Now we add the style attribute to each span...

These shirts come in
<span style="">hot red</span>
and <span style="">pastel green</span>.

...and we drop the appropriate style specifier in between the quote marks.

These shirts come in
<span style="color: red;">hot red</span>
and <span style="color: #99ff99;">pastel green</span>.

And here's the result:

These shirts come in hot red and pastel green.

  Introduction  Index Specifying Font Size