|
Topic: HTML
Adding Links to Your Web Page
Creating Links in HTML
Okay, with that drivel out of the way, it's time to put your newfound know-how to work (assuming, that is, I haven't scarred you for life!). To wit, this section shows you how to use HTML to add hypertext links to your Web page.
The HTML tags that do the link thing are <A> and </A>. (Why "A"? Well, as you'll find out later on-see the section "Anchors Aweigh: Internal Links"-you can create special links called anchors that send your readers to other parts of the same document, instead of to a different document.) The <A> tag is a little different from the other tags you've seen (you just knew it would be). Specifically, you don't use it by itself but, instead, you shoehorn into it the URL of your link. Here's how it works:
<A HREF="URL">
Here, HREF stands for Hypertext REFerence. Just replace URL with the actual URL of the Web page you want to use for the link (and, yes, you have to enclose the address in quotation marks). Here's an example:
<A HREF="http://www.logophilia.com/Home/homepage.html">
Now you can see why I made you suffer through all that URL poppycock earlier: it's crucial for getting the <A> tag to work properly.
You're not done yet, though; not by a long shot (insert groan of disappointment here). What are you missing? Right, you have to give the reader some descriptive link text on which to click. Happily, that's easier done than said because all you do is insert the text between the <A> and </A> tags, like so:
<A HREF="URL">Link text goes here</A>
Need an example? You got it (see the file LINK2.HTM on the disk):
Why not head to my
<A HREF="http://www.logophilia.com/Home/homepage.html">home page</A>?
Hypertext links are generally divided into two categories: external and internal.
An external link is one that sends the person who clicks it to a different document. You have two choices here: you can link to a Web page in a different directory or on a different system (I call this a "faraway" link), or you can link to a Web page in the same directory as the current page (I call this a "nearby" link).
An internal link (an anchor) sends the reader to a different part of the same document. The next few sections describe each type of link.
Creating an E-Mail Link
As I mentioned earlier, there's no reason a link has to lead to a Web page. In fact, all you have to do is alter the "how" part of a URL, and you can connect to most other Internet services, including FTP and UseNet.
In this section, however, I'll concentrate on the most common type of non-Web link: e-mail. In this case, someone clicking on an e-mail link will be presented with a screen (assuming their browser supports this kind of link, which most recent browsers do) they can use to send a message to your e-mail address. Now that's interactive!
This type of link is called a mailto link because you include the word mailto in the <A> tag. Here's the general form:
<A HREF="mailto:YourEmailAddress">The link text goes here</A>
Here, YourEmailAddress is your Internet e-mail address. For example, suppose I want
to include an e-mail link in one of my Web pages. My e-mail address is sara@e-tutorials.net, so I'd set up the link as follows:
You can write to me at my
<A HREF="mailto:sara@e-tutorials.net">e-mail address.</A>
How to Link to Other Net Resources |
If you want to try your hand at linking to other Net resources, here's a rundown of the type of URLs to use: |
Resource |
URL |
FTP (directory) |
ftp://Who/Where/ |
FTP (file) |
ftp://Who/Where/What |
Gopher |
gopher://Who/ |
UseNet |
news:newsgroup.name |
Telnet |
telnet://Who |
|
|