This covers the font and text properties of CSS. Let??™s end this chapter
with a brief practical example of what we've learned.
Using Font and Text Styles
Using the markup we developed in Chapter 1, let??™s look at how we
can transform a very ordinary-looking page into a more professional-
looking piece. Figure 3.25 shows the unstyled markup.
FIGURE 3.25 Here??™s the unstyled
markup of the page we saw in
Chapter 1.
STYLIN??™ FONTS AND TEXT 97
By applying only styles we learned in this chapter plus the margin
and background-color properties, the page suddenly looks like
someone actually designed it (Figure 3.26).
FIGURE 3.26 The styled page looks
much spif?¬? er.
Here are the styles:
1. * {margin:0; padding:0;}
We start by ???neutralizing??? all the default margins and padding
on the elements. These eat up a lot of vertical space in the
unstyled version. By removing all the default margins and padding,
only the elements we explicitly style have them.
2. body {font-family:verdana, arial, sans-serif; fontsize:
100%; margin:1em; background-color:#DFE;}
These are baseline styles for the font and page margins.
Pages:
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140