HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 10. FONT FAMILIES 107


font-family: "Times New Roman", times, serif;
font-family: helvetica, arial, sans-serif;
font-family: courier, monospace;
font-family: papyrus, fantasy;


Each font family specification starts withfont-family:and is followed by
a list of one or more fonts.


Best First: The best font choice should be listed first, and then list the
fall-back fonts to be used in case the best font is not available on your user’s
platform.


Generic Last: The last choice you list should always be one of the five
generic font families: serif, sans-serif, monospace, cursive, or fantasy. These
are guaranteed to be available on every platform.


Exam Question 187 (p.347): Tell what is wrong with this font spec:
font-family: Times Roman, serif;
Acceptable Answer:quotes needed on Times Roman


Exam Question 188 (p.347): Tell what is wrong with this font spec:
font-family: ARiaL, sans-serif;
Acceptable Answer:nothing


Exam Question 189 (p.347): Tell what is wrong with this font spec:
font-family: arial, sans-serif;
Acceptable Answer:nothing


Exam Question 190 (p.347): Tell what is wrong with this font spec:
font-family: sans-serif, arial;
Acceptable Answer:generic must be last


Exam Question 191 (p.347): Tell what is wrong with this font spec:
font-family: arial, sans-serif, serif;
Acceptable Answer:too many generics


Cross-Platform Awareness: If you are trying to get a particular look,
you should try to include an acceptable font for each major platform your
users might be using: Microsoft Windows, Mac OS X, Mac iOS (iPhone or
tablet), Android (phone or tablet), Linux.


Web Fonts: You may be able to select a downloadable font that works
across many platforms. But do not assume every platform will accept it.
See section 10.6 (page 110).

Free download pdf