22.06.2015 Views

o_19octlt3v29m1ul81r9513q81i4ra.pdf

Create successful ePaper yourself

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

Creating and Linking to External Style Sheets 99<br />

After creating the style sheet, you create a link to it in the area of each document<br />

that will use it. For example, if the style sheet is named default.css, you would link<br />

to it by inserting this code in the document’s area, as shown in the following:<br />

<br />

Note The name “default.css” is common, but not required. You can name your style sheet<br />

anything you like, as long as the name ends with a .css extension.<br />

An embedded style sheet takes precedence over an external one. For example, if your<br />

external style sheet specifies Roman numerals for ordered lists but your embedded style<br />

sheet specifies uppercase letters, ordered lists will be labeled with uppercase letters.<br />

Furthermore, any tag-specific styles you apply take precedence over both embedded and<br />

external style sheets. So, if you add a style rule to an individual tag, that setting will<br />

override any style sheet settings.<br />

In this exercise, you will create an external style sheet and link a Web page to it.<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\HTML5 SBS\06Styles\CreatingExternal folder.<br />

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

1. Select all the text between and but do not include those tags in<br />

the selection.<br />

2. Press Ctrl+X to cut the text from the document and store it in the Clipboard.<br />

3. Save the file, and then start a new document in Notepad.<br />

4. Press Ctrl+V to paste the text from the Clipboard into the new document.

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

Saved successfully!

Ooh no, something went wrong!