![]() |
The power of the World Wide Web is the ability to use hyperlinks that let you jump from one web-based document to another. Anchor tags, <a></a>, are used to define hyperlinks to other web documents that may reside on the same web server or elsewhere. The general format of the tag is:
<a href="URL">link_text</a>
where URL is the Uniform Resource Locator of the web document you are linking to and link_text is the text to be displayed as the link on the browser screen.
| This HTML... | Produces this... |
|---|---|
<a href="http://www.yahoo.com">Yahoo!</a> is the most visited site on the World Wide Web. |
Yahoo! is the most visited site on the World Wide Web. |
If you are creating a link to a web document that is not part of the site you are building, you must specify the the absolute, or fully qualified, URL as shown in the above example. On the other hand, if you want to link to another document in the same folder as the current document, you can provide the file name alone as the relative URL in the href attribute. This is shown in the following example.
| This HTML... | Produces this... |
|---|---|
Never touch <a href="wet.html">wet paint</a>. |
Never touch wet paint. |
A link of a different sort will
| This HTML... | Produces this... |
|---|---|
Send me an <a href="mailto:rknoblock@yahoo.com">email</a> if you have any comments. |
Send me an email if you have any comments. |