22.06.2015 Views

o_19octlt3v29m1ul81r9513q81i4ra.pdf

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

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

68 Chapter 5<br />

Practice Files Before you can use the practice files provided for this chapter, you need<br />

to download and install them from the book’s companion content location. See “Using<br />

the Practice Files” at the beginning of this book for more information.<br />

Hyperlinking to a Web Page<br />

No matter what type of hyperlink you want to create, the basic syntax is the same. It<br />

starts with the tag, and then uses an href= attribute which provides the URL or the<br />

path to the destination. For example, an opening tag might look like this:<br />

<br />

This is followed by the text that will appear underlined as the link text that you click, or<br />

by a reference to the image that will serve as a hyperlink. (You’ll learn more about images<br />

in Chapter 9, “Displaying Graphics.”) After that text is the closing tag. Here’s a complete<br />

example:<br />

Visit Microsoft.com for the latest<br />

information.<br />

When viewed in a browser, this produces a text-based hyperlink similar to that shown in<br />

the following image:<br />

Hyperlinks are underlined by default. You can specify alternative formatting for hyperlinks<br />

by using styles, as explained in Chapter 6, “Introduction to Style Sheets.”<br />

Using Partial Paths and Filenames<br />

In some cases, you do not need to provide a file name or a complete path to the destination<br />

in a hyperlink. It depends on the context and the file’s name.<br />

If you do not link to a specific page, the server that hosts the Web site responds by<br />

displaying the default page for that site (if one is available). If a browser does not request<br />

a specific page when accessing a server, most servers will send the default page, which is<br />

usually named either index or default. Perhaps you wondered why the main page of The<br />

Garden Company’s Web site is called index.htm—now you know.<br />

In Internet Explorer, type the following URL in the Address bar:<br />

http://www.microsoft.com/en/us

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

Saved successfully!

Ooh no, something went wrong!