10.07.2017 Views

246996016-HTML5-Step-by-Step

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

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

6 Introduction to Style<br />

Sheets<br />

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

4 Understand styles.<br />

4 Construct style rules.<br />

4 Create styles for nested tags.<br />

4 Create classes and IDs for applying styles.<br />

4 Apply styles to hyperlinks.<br />

4 Create and link to external style sheets.<br />

After you learn about cascading style sheets, you will wonder how anybody ever had the<br />

patience to create large Web sites without them. Cascading style sheets can save you a<br />

tremendous amount of time <strong>by</strong> standardizing the formatting of an entire Web page or<br />

group of pages.<br />

A cascading style sheet (CSS) is code that specifies formatting based on styles. You can<br />

store the CSS code in the section of the Web page to which you want it to apply,<br />

or you can store it in a separate file with a .css extension (which works well if you want<br />

the same CSS to apply to more than one Web page). The formatting then “cascades”<br />

down to the individual instances of each tag. You can also place a style directly within<br />

an individual tag if desired, as you did in Chapter 4, “Using Lists and Backgrounds.”<br />

In this chapter, you’ll learn how to construct style sheets, and how to attach them to a<br />

document—either <strong>by</strong> placing them within the document itself, or <strong>by</strong> linking to them as<br />

a separate file. You’ll learn how to define a style and how to apply it. The next several<br />

chapters will include further opportunities to practice with various style types.<br />

See Also Do you need only a quick refresher on the topics in this chapter? See the Key Points<br />

section at the end of this chapter.<br />

85

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

Saved successfully!

Ooh no, something went wrong!