HTML and CSS Reference
In-Depth Information
note
You cannot mix integers and percentages in the same color unit desig-
nation. White is
rgb(255,255,255)
or
rgb(100%,100%,100%)
, but not
rgb(255,100%,255)
.
The hue-saturation-lightness color scheme offers a way to look at the
color wheel that can be more intuitive when working with colors of a
similar hue or tonality. Hue (
h
) is a number from 0 to 360 representing
a radial position on the color wheel (0 or 360=red, 120=green, 240=blue).
Saturation (
s
) is a percentage value from 0 to 100 percent with values
closer to 0 percent approaching desaturated, or gray. Lightness (
l
) is
again a percentage value from 0 to 100 percent, where 0 percent is black
and 100 percent is white.
.error { border-color:
hsl(0, 75%, 38%);
} /* a muted red */
A chart of HSL colors in the CSS3 Color Module specification (
http://
www.w3.org/ TR/css3-color/#hsl-examples
)
illustrates how the three
scales work together to create colors.
The HTML 4 specification defined the following 16 color keywords and
their corresponding hex values:
aqua
,
black
,
blue
,
fuchsia
,
gray
,
green
,
lime
,
maroon
,
navy
,
olive
,
purple
,
red
,
silver
,
teal
,
white
, and
yellow
.
Keywords are case insensitive and are not placed between quotes.
body { color:
red
; }
Several (131 to be exact) more commonly supported color keywords, such
as
pink
,
plum
,
deepskyblue
, and
firebrick
, originally defined in the SVG
specification, were added in CSS3, bringing the number of color keywords
to 147.