10.07.2017 Views

246996016-HTML5-Step-by-Step

Create successful ePaper yourself

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

7 Formatting Text <strong>by</strong><br />

Using Style Sheets<br />

In this chapter, you will learn how to<br />

4 Specify a font family.<br />

4 Specify a font size and color.<br />

4 Apply bold and italics.<br />

4 Apply strikethrough and underlining.<br />

4 Create inline spans.<br />

4 Adjust spacing between letters.<br />

Learning how to create style rules opens up a whole new world in HTML formatting.<br />

Virtually anything that you can do in a word-processing program, you can do in HTML<br />

<strong>by</strong> using styles.<br />

You might be wondering whether the simple text-formatting tags you learned about<br />

in Part 1 of the book, such as the and tags, are still relevant. They are—to a<br />

degree. The W3C is increasingly focused on applying text formatting <strong>by</strong> using styles,<br />

which means you should try to use the style-based formatting that you’ll learn in this<br />

chapter (and the next). However, those old tags still work perfectly well when you create<br />

<strong>HTML5</strong> documents, and Web browsers will continue to support tag-based formatting for<br />

a long time. If you’ve already created an extensive Web site that uses formatting tags,<br />

there’s no big rush to recreate the existing pages <strong>by</strong> using styles. For new pages, however,<br />

it’s a good idea to do it “right” from the start <strong>by</strong> using styles for all your formatting.<br />

In this chapter, you’ll learn about character-based formatting—that is, formatting that<br />

makes individual characters look a certain way. You’ll learn how to specify fonts, sizes,<br />

and colors; how to use styles to apply bold, italic, strikethrough, or underline styling to<br />

your text; and how to add a background to text and adjust the spacing between letters.<br />

In Chapter 8, “Formatting Paragraphs <strong>by</strong> Using Style Sheets,” you’ll learn about paragraph<br />

formatting features such as line spacing, indentation, and alignment.<br />

103

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

Saved successfully!

Ooh no, something went wrong!