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.

Creating Classes and IDs for Applying Styles 95<br />

1. Apply a class named appleton to all the Appleton Acres items.<br />

<br />

Sampson & Company All-Natural Pesticide<br />

Vickers and Vickers Fertilizer Sticks<br />

Appleton Acres Big Sack of Bulbs, Tulips<br />

Jackson and Perkins Climbing Rosebushes<br />

Easton Create-Your-Own Paving Stones Kit<br />

Appleton Acres Big Sack of Bulbs, Daffodils<br />

Appleton Acres Big Sack of Bulbs, Hyacinths<br />

Appleton Acres Big Sack of Bulbs, Crocuses<br />

Hawthorne Hills Hosta, 3-Pack<br />

Sampson & Company All-Natural Herbicide<br />

<br />

2. Apply a class named sampson to the Sampson & Company items.<br />

<br />

Sampson & Company All-Natural Pesticide<br />

Vickers and Vickers Fertilizer Sticks<br />

Appleton Acres Big Sack of Bulbs, Tulips<br />

Jackson and Perkins Climbing Rosebushes<br />

Easton Create-Your-Own Paving Stones Kit<br />

Appleton Acres Big Sack of Bulbs, Daffodils<br />

Appleton Acres Big Sack of Bulbs, Hyacinths<br />

Appleton Acres Big Sack of Bulbs, Crocuses<br />

Hawthorne Hills Hosta, 3-Pack<br />

Sampson & Company All-Natural Herbicide<br />

<br />

3. In the area, create a style rule that makes items in the appleton class green.<br />

<br />

hr {color: green; background-color: green; height: 3}<br />

.appleton {color: green}<br />

<br />

Note Each style rule here is run in as a single line, whereas in earlier examples, rules were<br />

broken into multiple lines for readability. It makes no difference which way you do it. The<br />

one-line method is more compact, but the multi-line method is easier to browse when<br />

editing code. From this point on in the book, most style rules will be written in the more<br />

compact form to save space.<br />

4. In the area, create a style rule that makes items in the sampson class blue.<br />

<br />

hr {color: green; background-color: green; height: 3}<br />

.appleton {color: green}<br />

.sampson {color: blue}<br />

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

Saved successfully!

Ooh no, something went wrong!