HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 10. FONT FAMILIES 100


The latent advantage of this approach is that you can change the attributes
of any class very easily and have it apply to all the content that belongs to
that class. You do not need to look for each item in your HTML and fix it
separately.


Exam Question 175(p.346): In CSS what is the one-character symbol
for class?
Required Answer:.


The one-character symbol for class is.(dot).


10.1.2 Class Names


If you get to choose your class names, I recommend you follow the simple
rule: start with a letter and continue with letters or digits or dashes. Un-
derscore counts as a letter. Case matters. (Big A and little a are recognized
as being different from each other.)


Exam Question 176(p.346):What is the simple rule for creating a legal
class name?
Acceptable Answer:letter first, then letters or digits or dashes


This is the same rule that many computer languages use for creating variable
names (except for dashes).


The complex rule for class names is that you can use almost any character,
but you have to properly escape some of them, which can make life difficult.


Having established a nice way to specify fonts through the use of classes, we
will now turn to the fonts themselves.


10.2 What Is A Font?


A font is a typeface. The origin of the word font is related to fondue, like
dipping bread into melted cheese. The letters used in printing were originally
made from melted lead. (The distance between lines of text is still called
leading, pronounced led-ing.)


Fonts can affect the emotional response that users have to your webpage.
They can be heart-warming, amusing, or really annoying.


The use of interesting fonts can really spice things up. They are especially
nice for headings. It can be a problem if the body text gets too fancy because

Free download pdf