HTML and CSS Reference
In-Depth Information
Color Format
Description
Example
Specification-
defined named
colors
There are 17 defined colors under CSS 2.1.
Each is listed here with its six-digit hex form
equivalence:
maroon ( #800000 ) red ( #ff0000 )
orange ( #ffA500 ) yellow ( #ffff00 )
olive ( #808000 ) purple ( #800080 )
fuchsia ( #ff00ff ) white ( #ffffff )
lime ( #00ff00 ) green ( #008000 )
navy ( #000080 ) blue ( #0000ff )
aqua ( #00ffff ) teal ( #008080 )
black ( #000000 ) silver ( #c0c0c0 )
gray ( #808080 )
Other color keywords may be commonly
used but are ad hoc in their definition.
See Appendix C for more information.
body {font-family:
Arial; font-size: 12pt;
color: red;}
Commonly defined
named colors
Most browsers support a number of
common colors based upon the X11
windowing system palette, such as
mintcream . Appendix C provides a
complete list of these extended colors
and a discussion of the potential pitfalls
of using them.
#gap {color: khaki;}
System Color
Names
CSS2 introduced named color keywords
which allows Web page colors to be
matched to an operating system's color
use. A complete list of the allowed values
and their meaning is found in Appendix C.
While these names are commonly
supported, there is some concern that
they will not be supported in CSS3.
.formLabels {color:
CaptionText;}
input[type="button"]
{background-color:
ButtonFace;}
6-Hex Color
CSS's six-digit hexadecimal format is
the same as color defined in (X)HTML.
The format specifies color as # rrggbb ,
where rr is the amount of red, gg the
amount of green, and bb the amount of
blue, all specified in a hexadecimal value
ranging from 00 to FF.
div {font-family:
Courier; font-size:
10pt; color: #00CCFF;}
3-Hex Color
This is an RGB hexadecimal format of
#rgb , where r corresponds to a hex
value (0-F) for red, g for green, and b for
blue. For example, #f00 would specify
pure red, while #fff would specify white.
Given its data limits, the format is less
expressive than 6-Hex Color.
span {font-family:
Helvetica; font-size:
14pt; color: #0CF;}
T ABLE 5-4 CSS Color Values (continued)
Search WWH ::




Custom Search