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.

Getting Tony a new font-family<br />

Let’s get Tony set up <strong>with</strong> a font-family. We’re going to start <strong>with</strong><br />

some clean sans-serif fonts. <strong>First</strong>, create a new file, “journal.css” in the<br />

“chapter9/journal” folder and add this rule:<br />

body {<br />

font-family: Verdana, Geneva, Arial, sans-serif;<br />

}<br />

We’re setting the<br />

font-family property<br />

on the element.<br />

Remember, the<br />

elements in the <br />

will inherit these fonts.<br />

Remember, you fixed up Tony’s journal to<br />

be strict X<strong>HTML</strong> in Chapter 7.<br />

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

<br />

<br />

<br />

<br />

<br />

My Trip Around the USA on a Segway<br />

<br />

<br />

.<br />

.<br />

.<br />

<br />

<br />

You’ll see Verdana<br />

on most PCs. And Geneva on<br />

We’ve chosen a set of<br />

sans-serif fonts here.<br />

most Macs.<br />

Arial is<br />

common<br />

on both.<br />

Now you need to link Tony’s journal to the new style sheet file. To do that, open<br />

the file “journal.html” in the “chapter9/journal” folder. All you need to add is the<br />

element to link in the style in “journal.css”, like we did below.<br />

After you’ve made this change, save the file, fire up your browser and load the page.<br />

And if all else<br />

fails, we have<br />

the default<br />

sans-serif.<br />

Here’s where we’re<br />

linking in the new<br />

“journal.css” file.<br />

you are here 349

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

Saved successfully!

Ooh no, something went wrong!