|
This page describes how to:
LinksThe Anchor element is the essence of HTML. It is marked text that is the start and/or destination of a hypertext link. The information on this page is linked under the following headings.
AnchorsLinks depend on a container tag called an Anchor (<a>) tag, which accepts several attributes, but either the NAME or HREF attribute is required. All links are anchored at both ends. Anchors can contain (among other things):
Anything between the opening and closing anchor tags (<A> and </A>) of an anchor link will be the "clickable" item. Here's what a link to the unrelated.net home page looks like: You can link
For example, Page Top, (<a href="#top">Page Top</a>) links to the top of this page, where an anchor tag (<a name="top"></a>) is located. NameYou use the NAME attribute with an ANCHOR tag to specify a location in a page so you can link to it. Look at the source for this page and this text as an example. Format: <a name="name">Name</a> Remote-URL LinksA URL is a "uniform resource locator" and it is the domain name and path to a page or other file or directory on a website. Any link to another URL is a remote link. Format: <a href="http://unrelated.net">unrelated.net</a> (link to website) Format: <a href="http://unrelated.net/learnweb/lsn05.htm#remote">http://unrelated.net/learnweb/lsn05.htm#remote</a> (link to specific location in a page in a website) Local-Relative LinksA "absolute path" includes the full file-system path to a file or directory. A "relative path" indicates the location of a file or directory in relation to the file containing the link that uses the relative path. So, if you want to link to a page in a different directory, but you don't know or don't want to use the full absolute path, you would use the relative path in your link. For example: This link:
This link: -- links to a file in a directory under the directory that houses the file containing the link. This link:
-- links to a file in a directory at the same level as the directory that houses the file containing the link. Mail To LinksYou can use anchor tags to embet "mailto:" links so people can send you mail. These only work, however, if the person using the link can send mail (has sendmail configured) from his or her browser. Format: <a href="mailto:webmaster@unrelated.net">Send Email To the Webmaster</a> Graphic LinksThere are several ways to use images as links. The easiest is just to use a graphic instead of text within an ordinary hypertext link. The format to include a graphic in an HTML page is: <img src="./image.gif"> To use that graphic in a hypertext link: <a href="./lsn04"><img src="./image.gif">Lesson 4</a> You can also use things called image maps (to link to several pages or locations from a single image) or javascript, java, or Flash images for links too. Some of these options are discussed later in this course. Other LinksYou can create a variety of other links for file transfer and internet search and so on. These are mostly outside the scope of this course. |