HTML and CSS Reference
In-Depth Information
■
sans-serif
: A typeface design with plain or straight features;
typically Arial
■
cursive
: A cursive or handwriting-like typeface
■
monospace
: A fixed-width font, commonly used for displaying code or
other text where character width is important like ASCII art; typically
Courier or Courier New
■
fantasy
: A highly stylized typeface
See “Specifying Typefaces” later in this chapter for common examples
and additional discussion of choosing and defining font families.
The
font-size
property controls the size of the text in the element and
may be defined as a fixed size or a size relative to the font size of the
parent element. Browsers set a default size based on settings in the user
preferences, commonly 16px.
■
<length>
: A length measurement
■
<percentage>
: A percentage value measured against the computed
value of the parent element's
font-size
■
xx-small
|
x-smal
l |
small
|
medium
|
large
|
x-large
|
xx-large
: Fixed-
size values along a browser-defined scale
■
larger
|
smaller
: A value relative to the parent element's size; typi-
cally representing a step up or down the previous scale (
xx-small
through
xx-large
)
Relative and percentage font sizes are based on their parent element's
computed font size. The effect of this behavior may be compounded
when nesting elements. The following sample (
Figure 9.1
on the next
page) demonstrates how font sizes are calculated for nested elements.