Section 10. About Creating Hyperlinks

10. About Creating Hyperlinks

BEFORE YOU BEGIN

2 Use HTML Tags

7 Set Up a Web Page's Basic HTML Structure


SEE ALSO

11 About Adding Graphics


The heart of the World Wide Web is its capability to link to other web pages, resources, and information. So now we're going to cover how to put links on your page.

You use the anchor tag <A> and </A> to link from your website to another URL . The URL you link to can be anything on the Interneta web page, a video, or a file, for example. When you link to a web page, that page will appear in your browser. When you link to something other than a web page, what happens will be determined by what exactly you're linking to, and how your computer has been set up. For example, if you link to a music file, the file might either download to your computer, or start playing on your computer.

KEY TERM

URL (uniform resource locator) An address on the Internet, such as http://www.samspublishing.net.


Let's say that on your page, you want to put a link on the word Tolstoy's that, when clicked upon, will send the browser to the www.ltolstoy.com site, a site devoted to Leo Tolstoy and all his works. Here's how to create the link using the anchor tag:

<A HREF=" http://www.ltolstoy.com ">Tolstoy's</A>

In this instance, the text Tolstoy's will show up as a link on your web page, and when clicked on, will send a browser to the site http://www.ltolstoy.com. As you can see, the anchor tag uses the HREF attribute to specify a URL to which you link. The URL has to be surrounded by quotation marks.

Note that you have to use the full URL to the page to which you're linking, including the http:// .

When you put a link on your page, it shows up as the familiar underlined text you see on the Web. The text that is underlined and linked fromin our instance, the word Tolstoy's is often called a label.

When you link, you can link not just to the home page of a site, but to any individual page on the site. So, in our example, if we want to link the word Tolstoy to a page on the www.ltolstoy.com site that contains his biography, our link will look like this:

<A HREF=" http://www.ltolstoy.com/about/biography.html ">Tolstoy's</A>

TIP

When coding your page, try to keep labels as short as possible. Making entire sentences show up as links makes the page very hard to read. If possible, keep the labels to several words or fewer. Using a brief description of the destination page as the link text is much more useful to visitors than simply using the nondescriptive Click Here .




Sams Teach Yourself Creating Web Pages All in One
Sams Teach Yourself Creating Web Pages All in One
ISBN: 0672326906
EAN: 2147483647
Year: 2006
Pages: 276

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net