By name

You can specify color values by name as follows:

    h1 {color: olive;}

The CSS 2.1 specification accepts only 17 color names for use in style sheets (CSS 1 and CSS 2 had only 16 names; orange was added in Version 2.1.) The color names are:

aqua

green

orange

white

black

lime

purple

yellow

blue

maroon

red

 

fuchsia

navy

silver

 

gray

olive

teal

 

Other names from the complete list of color names may be supported by some browsers. For the complete list, see Appendix D.

Get Web Design in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.