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.

76 Chapter 5<br />

To refer to the anchor point, include its name in the href attribute. Precede the anchor<br />

name with a pound sign (#). If the anchor point is in the same document as the hyperlink,<br />

you can use a relative reference like this:<br />

View the Conclusion<br />

Otherwise, you must include the name of the file in which the anchor is located. For<br />

example, if the anchor were in a file called report.htm, it would look like this:<br />

View the Conclusion<br />

The same rules apply to the file name as they do with regular hyperlinks. If the document<br />

is not in the same folder, you must refer to the folder either absolutely or relatively.<br />

In this exercise, you will create and link to anchor points in an HTML document.<br />

SET UP Use the spray.htm and index.htm files in the practice file folder for this<br />

topic. These files are located in the Documents\Microsoft Press\<strong>HTML5</strong> SBS\05Links\<br />

CreatingAnchors folder. Open the spray file in Notepad and in Internet Explorer.<br />

1. Locate the Equipment heading (not the list item), enclose it with an anchor tag, and<br />

include equipment with the name attribute.<br />

Equipment<br />

Note You can nest the tags within the tags or vice versa, but be consistent at<br />

both ends.<br />

2. Repeat step 1 for the other level headings in the document, using the lowercase<br />

title of each one as the anchor name.<br />

Mixing<br />

...<br />

Spraying<br />

...<br />

Cleanup<br />

3. In the bulleted list at the top of the document, create a hyperlink from the Equipment<br />

list item to the corresponding heading.<br />

Equipment<br />

4. Repeat step 3 for each of the other list items.<br />

Mixing<br />

Spraying<br />

Cleanup<br />

5. Save the file, and then refresh the Internet Explorer display.<br />

6. Click each of the hyperlinks in the bulleted list; click the Back button after each one<br />

to return to the top of the page.

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

Saved successfully!

Ooh no, something went wrong!