46
342
Chapter 9
A lot of the CSS properties are dedicated to helping you style your text. Using
CSS, you can control typeface, style, color, and even the decorations that are
put on your text, and we’re going to cover all these in this chapter. We’ll start
by exploring the actual fonts that are used to display your pages. You’ve already
seen the font-family property and in this chapter you’re going to learn a lot
more about specifying fonts.
Before we dive in, let’s get the 30,000 foot view of some properties you can use
to specify and change the look of your fonts. After that, we’ll take the fonts one
by one and learn the ins and outs of using each.
Text and fonts from 30,000 feet
Andale Mono
Arial
Arial Black
Comic Sans
Courier New
Georgia
Impact
Times New Roman
Trebuchet MS
Verdana
body is 14px
h1 is 21px
p is 14px
h2 is 17px
body {
font-size: 14px;
}
body {
font-family: Verdana, Geneva, Arial, sans-serif;
}
Customize the fonts in your pages with the font-family property.
Fonts can have a dramatic effect on your page designs. In CSS, fonts are
divided into “font families” from which you can specify the fonts you’d
like used in each element of your page. Only certain fonts are commonly
installed on most computers, so you need to be careful in your font
choices. In this chapter we’ll take you through everything you need to
know to specify and make the best use of fonts.
Control the size of your fonts with the font-size property.
Font size also has a big impact on the design and the readability of your
Web pages. There are several ways to specify font sizes with CSS, and in
this chapter we’ll cover each one, but we’ll also teach you how to specify
your fonts in a way that allows your users to increase the font size without
affecting your designs.
common text properties