untitled

(John Hannent) #1
My defense is straightforward. Many computer books include long code exam-
ples that go on and on, sometimes for pages. I think that’s bad practice. Sample
code should make its point as simply and clearly as possible. I don’t want the
reader struggling through lots of code that’s not related to the topic being illus-
trated. So I leave out as much as I can (for example, it’s desirable to use the
<title>element in your Web pages, but you won’t find that in this book).

Another alternative technique, although perhaps less important than alt, is
providing a default font family. You do this on the assumption that not every-
one has, for example, Microsoft’s famous sans serif font Arial. Yet you want
even those viewers to see a sans font (not a serif font, like Times Roman).
This isn’t essential, but it’s nice. Even some validators that check CSS code
suggest that you do this, if they catch you specifying a particular font family,
like this:

p
{
font-family: arial
}

The suggestion is that you specify the font you really want first, and then you
can add any additional fonts that you want to use as substitutes. Finally, if
none of your substitutes are available (where are these people with zero
fonts?), you end your wish list with a generic font, of which CSS has five:
Serif, Sans Serif, Monospace, Cursive, and Fantasy. I suggest that you stick
with the first three, unless you design wedding invitations (Cursive) or work
for a clown school (Fantasy). Here’s how to add a generic font family:

p
{
font-family: arial, sans-serif
}

Letting the User Decide ..............................................................................


How about providing some alternative style sheets, rather than just enforcing
one look on your Web documents? Who gets to select between these alterna-
tives? Your audience, the viewers of your Web pages, the welcome guests.
I’m not suggesting that you become as superhumanly accommodating and
polite as some societies. I understand that in some countries, hurricanes are
respectfully described as “guest winds.” I’m not prepared to go that far. But
civility is always welcome, and users usually appreciate having some say in
how things look.

Chapter 19: Ten Topics That Don’t Fit Elsewhere in the Book (But Are Important) 333

Free download pdf