HTML and CSS Reference
In-Depth Information
Because the available fonts vary with each user's operating system, the challenge is
to choose a list of fonts known as
Web safe fonts
, which will be displayed in mostly
the same way in all browsers and on all devices. Figure 3-26 shows several commonly
used fonts.
Figure 3-26
Web safe fonts
A general rule for printing is to use sans-serif fonts for headlines and serif fonts for
body text. For computer monitors, which have lower resolutions than printed material,
the general rule is to use sans-serif fonts for headlines and body text, leaving serif fonts
for special effects and large text.
Setting Font Face and Sizes
• To define a font face, use the style property
font-family:
fonts
;
where
fonts
is a comma-separated list of fonts that the browser can use with the ele-
ment. List specific fonts first and complete the list with a generic font.
• To set a font size, use the style property
font-size:
size
;
where
size
is a CSS unit of length in either relative or absolute units.
• To set kerning (the space between letters), use the following style property:
letter-spacing:
size
;
• To set tracking (the space between words), use the following style property:
word-spacing:
size
;