HTML and CSS Reference
In-Depth Information
Table 14.1 Style Sheet Properties (continued)
Property
Value/Example
Tags Affected
Margins and Borders (Continued)
margin-right
20em,45%
All
margin-top
1cm, 20%
All
padding
2em, 4em, 6em (right, bottom, left)
All
padding-bottom
2em, 20%
All
padding-left
.25in, 20%
All
padding-right
.5cm, 35%
All
padding-top
20px, 10%
All
width
12em, 30%, auto (initial width value)
Block-level and
replaced element a
a. A replaced element has set or calculated dimensions, such as img, select, textarea .
14.4.1 Units of Measurement
You can express the size of a given property in different units of measurement; for exam-
ple, a font size can be expressed in pixels or ems or points (the default is pixels). Colors
can also be expressed in combinations of red, green, and blue, either by the name of the
color, or its hexadecimal value.
Measurement is used in three categories: absolute units, relative units, and proportional
units. For example, a point size measurement (e.g., 14pt ) would be the actual size (absolute)
of a particular font; a value (e.g., 5em) could be relative to the size of the current font; and a
color (e.g., 50%80%100% ) could represent red, green, and blue as a percentage value of the
original color. Relative sizes larger and smaller (relative to the parent font) can be used when
defining a font. These sizes are determined by browsers or other user agents. 2 Tables 14.2
and 14.3 introduce the types of measurements that are often used in style sheets.
Table 14.2 Font Size Units
Absolute Font Size Unit
inches (in)
centimeters (cm)
Continues
2. User agents include Web browsers, search engine crawlers (spiders), cell phones, screen readers, and
Braille browsers used by people with disabilities.
 
 
Search WWH ::




Custom Search