HTML and CSS Reference
In-Depth Information
Given the multitude of CSS properties, there is also a multitude of values to which they
can be set. We next introduce measurements and will see their use throughout the examples
in this and the following chapters.
Measurements and Values
CSS properties support a wide variety of values, from keywords like xx-large , underline ,
and solid , to a variety of absolute measurements like inches ( in ) and centimeters ( cm ), to
often poorly understood relative measurements like em units, ex values, and percentages. We
present an overview of the types of measurements and values found in CSS in Table 4-11.
Lengths are used for horizontal or vertical
measurements. Absolute length units
supported in CSS 2.1 include inches ( in ),
centimeters ( cm ), millimeters ( mm ), points
( pt ), and picas ( pc ). A single point is equal
to 1/72 nd of an inch and thus does not
equate to a pixel unless there are 72 pixels
per inch on screen. A pica is equal to
12 points (in other words, 1/6 th of an inch).
Absolute measures should be used when
the physical characteristics of the display
medium are well understood, such as in
p {margin: 0.5in;}
#src {line-height: 5cm;}
h3 {letter-spacing: 2mm;}
.small {font-size: 9pt;}
h1 {font-size: 8pc;}
There are 17 defined colors under CSS 2.1.
Each is listed here with its six-digit hex form
p.intro {
background-color: orange;
color: black;}
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.
T ABLE 4-11 CSS Units and Lengths
Search WWH ::

Custom Search