Links are embedded into an HTML document using the anchor tag.
There are five basic ways to use the anchor tag (see examples in the table below):
| Anchor tag | <A> |
| End tag | </A> |
| Attributes |
HREF="URL_of_destination" NAME="anchorname" TARGET="_blank" to open link in a new window |
|
Example: absolute link |
<A HREF="http://www.tufts.edu">Link to Tufts</A> |
|
Example: relative link |
<A HREF="links.html">Link to a file named link.html in local directory</A> |
|
Example: sending an email |
<A HREF="mailto:username@tufts.edu">Send an email to username@tufts.edu</A> |
|
Example: creating and using an anchor to jump to specific location on a page |
<A NAME="here"></A> <A HREF="#here>Go to the anchor named "here" in current document</A> |
Everything placed between the <A HREF=" "> and </A> constitutes the link; you can embed images and text as part of the link.
Exercise 4
|