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.

88 Chapter 6<br />

Next, type a set of curly braces (you can place them on separate lines for greater readability,<br />

if you want). Then place the rule inside the braces. For example, to create a rule<br />

that makes the text of a first-level heading red, use the following:<br />

<br />

h1 {<br />

color: red<br />

}<br />

<br />

If you have more than one rule to apply, such as a color plus a typeface, separate the<br />

rules with semicolons within the curly braces. It is customary but not required to write<br />

each rule on its own line. For example, to specify that the heading text must be both red<br />

and 14 pixels in height, include the following in your rule:<br />

<br />

h1 {<br />

color: red;<br />

font-size: 14px;<br />

}<br />

<br />

If multiple tags should have the same rule applied to them, you can list them together<br />

and separate them <strong>by</strong> commas. For example, if all heading styles through <br />

should be red, you could write:<br />

<br />

h1, h2, h3, h4, h5, h6 {<br />

color: red<br />

}<br />

<br />

In this exercise, you will create an embedded style sheet governing the appearance of<br />

horizontal lines.<br />

SET UP Use the index.htm file in the practice folder for this topic. This file is located<br />

in the Documents\Microsoft Press\<strong>HTML5</strong> SBS\06Styles\ConstructingRules folder.<br />

Open the index file in Notepad and in Internet Explorer.<br />

1. In Internet Explorer, examine the horizontal lines in the index file.

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

Saved successfully!

Ooh no, something went wrong!