HTML and CSS Reference
In-Depth Information
Color Format
Description
Examples
RGB
CSS colors can also be defined using
the keyword rgb , followed by three
numbers between 0 and 255, contained
in parentheses and separated by
commas, with no spaces between
them. RGB color values can also be
defined using percentages. The format
is the same, except that the numbers
are replaced by percentage values
between 0% and 100%.
#p1 {color:
rgb(204,0,51);}
p {color:
rgb(0%,10%,50%);}
RGBa Color
Like RBG color, but this adds an alpha
channel value to specify the opacity of
the color. An RGBa is specified via a
function style rgba(r,g,b,a) value,
where colors r , g , and b are specified
as decimal values from 0 to 255 or
a percentage from 0 to 100% and
the alpha channel value for defining
opacity is a number between 0 (fully
transparent) and 1 (fully opaque). Values
outside this range will be rounded up or
down to fit the closest value.
#redtrans {color:rgba
(255,0,0,0.4);}
T ABLE C-4 CSS Color Values (continued)
N OTE Testing reveals that depending on operating system color changes, some browsers may not
map these UI color names correctly and often default to black.
CSS Color-Related Properties
Numerous CSS properties allow for color values. Table C-6 lists each property, a brief
example of its use, and an indication in which CSS version the property first appeared.
Readers looking for more information about the usage of these properties should see
Chapters 5 and 6, which provide a reference for standard and emerging or nonstandard
CSS properties, respectively.
N OTE Some details about browser and version support, particularly in regard to the CSS 3+ related
properties, are omitted from Table C-6. The purpose here is to provide a simple cross-reference.
See Chapters 5 and 6 for a complete discussion of each property.
 
Search WWH ::




Custom Search