04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

some fonts questions<br />

Test driving Tony’s new fonts<br />

Open the page <strong>with</strong> the new <strong>CSS</strong> in the browser and you<br />

should see we’ve now got a nice set of sans-serif fonts.<br />

Let’s check out the changes...<br />

The font definitely gives Tony’s Web page a<br />

new look. The headings now have a cleaner look<br />

<strong>with</strong>out the serifs on the letters, although they<br />

still look a tad large on the page.<br />

350 Chapter 9<br />

The paragraph text is also<br />

clean and very readable.<br />

Because font-family is an inherited property,<br />

all elements on the page are now using a<br />

sans-serif font, even the list elements...<br />

And if the serif fonts were more<br />

your cup of tea, don’t let us stop you.<br />

You can always redo the font-family<br />

declaration to use serif fonts.<br />

there are no<br />

Dumb Questions<br />

Q: How do I specify a font<br />

<strong>with</strong> multiple words in the<br />

name, like Courier New?<br />

A: Just put double quotes<br />

around the name in your fontfamily<br />

declaration, like this:<br />

font-family: “Courier New”,<br />

Courier;<br />

... and the s.<br />

Q: So the font-family<br />

property is really a set of<br />

alternative fonts?<br />

A: Yes. It’s basically a<br />

priority list of fonts. The first is<br />

the font you’d like used, followed<br />

by a good substitute, followed by<br />

more substitutes, and so on. For<br />

the last font, you should specify<br />

the catch-all generic “sans-serif”<br />

or “serif”, which should be in the<br />

same family as all the fonts in<br />

your list.<br />

Q: Are “serif” and “sansserif”<br />

real fonts?<br />

A: “serif” and “sans-serif”<br />

are not the names of actual<br />

fonts. However, your browser<br />

will substitute a real font in<br />

place of “serif” or “sans-serif” if<br />

the other fonts before it in the<br />

font-family declaration can’t be<br />

found. The font used in its place<br />

will be whatever the browser<br />

has defined as the default font in<br />

that family.<br />

Q: How do I know which<br />

to use? Serif or sans-serif?<br />

A: There are no rules.<br />

However, on a computer display,<br />

many people consider sans-serif<br />

the best for body text. You’ll<br />

find plenty of designs that use<br />

serif for body text, or mix serif<br />

fonts <strong>with</strong> sans-serif fonts. So,<br />

it really is up to you and what<br />

kind of look you want your page<br />

to have.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!