04.06.2013 Views

Head First HTML with CSS

Head First HTML with CSS

Head First HTML with CSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Adding style to your fonts<br />

You’re familiar <strong>with</strong> italic text, right? Italic text<br />

is slanted, and sometimes has extra curly serifs.<br />

For example, compare these two styles:<br />

not italic The italic text is slanted to the right<br />

italic<br />

You can add an italic style to your text in<br />

<strong>CSS</strong> using the font-style property:<br />

font-style: italic;<br />

However, not all fonts support the italic style,<br />

so what you get instead is called oblique text.<br />

Oblique text is also slanted text, but rather<br />

than using a specially designed slanted set of<br />

characters in the font, the browser just applies<br />

a slant to the normal letters. Compare these<br />

non oblique and oblique styles:<br />

not oblique<br />

oblique<br />

You can use the font-style property<br />

to get oblique text too, like this:<br />

font-style: oblique;<br />

In practice, you’re going to find that, depending<br />

on your choice of font and browser, sometimes<br />

the two styles will look identical, and sometimes<br />

they won’t. So, unless italic versus oblique is<br />

very important to you, choose one and move<br />

on. If, on the other hand, it is important, you’ll<br />

need to test your font and browser combination<br />

for the best effect.<br />

and has extra curls on the serifs.<br />

A common mistake is to<br />

write “italic” as “italics”.<br />

If you do, you won’t see<br />

italic text. So remember<br />

to check your spelling.<br />

The regular letters are<br />

slanted to the right in<br />

the oblique style.<br />

styling <strong>with</strong> fonts and colors<br />

Italic and oblique styles<br />

are two styles that<br />

give fonts a slanted<br />

appearance.<br />

Unless you can control<br />

the fonts and browsers<br />

your visitors are<br />

using, you’ll find that<br />

sometimes you get italic,<br />

and sometimes oblique,<br />

no matter which style<br />

you specify.<br />

So just go <strong>with</strong> italic<br />

and don’t worry about<br />

the differences (you<br />

probably can’t control<br />

them anyway).<br />

you are here 361

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

Saved successfully!

Ooh no, something went wrong!