The world wide web would be nowhere without links. Without them, there would be no way to get from one page to another without typing in the address by hand.
The A (anchor) element is used to make links from one document to another. In addition, it is used to create targets for other links to link to. To make a link you enclose the text you want to be marked as a link in an A element:
The <A href="next.html">next section</A>
That example might be rendered thus:
The next section.
As you can see, there are essentially two parts to an A element - its content, enclosed within the A element; and the address to which it is linking, specified by href.
In addition to specifying the hypertext reference of the anchor, the following attributes may be used:
To use absolute URIs, you must specify the type of mechanism that is used to link to the resource. For example, <A href="http://www.richinstyle.com"> or ftp://www.foo.com.
In addition to these, you may also specify a link to an e-mail address. For example, <A href="mailto: firstname.lastname@example.org">.
Relative URIs specify the location of linked resources relative to the location of the linking document. For example, if a document is http://www.richinstyle.com/guides/links4.html, then <A href="html4.html"> is interpreted as relative to the directory that links4.html is in. Thus that A element would result in http://www.richinstyle.com/guides/html4.html.
In addition, you may specify a directory - <A href="/copyright.html"> from http://www.richinstyle.com/guides/html4.html means http://www.richinstyle.com/copyright.html, since the / means relative to the root directory.
<A href="./html4.html"> from http://www.richinstyle.com/guides means http://www.richinstyle.com/guides/html4.html, since the '.' means the current directory.
<A href="../copyright.html"> from http://www.richinstyle.com/guides means http://www.richinstyle.com/copyight.html, since the '..' means up one directory.
Finally, <IMG src="guides/html.gif"> from http://www.richinstyle.com means http://www.richinstyle.com/guides/html.gif.
If you want to link to a particular part of a document, for example to make cross-references within a document, it is essential to be able to refer to a particular party of the document.
This is done using the A element with the name attribute. For example:
<H1> <A name="x"></A> A heading </H1>
This could then be referred to by <A href="#x">, or <A href="http://www.richinstyle.com/document.html#x"> (i.e., you add the '#' sign and the name of the link to the URI).
Note that two identical anchor names cannot appear in the same document, and even though names are case-sensitive, they cannot be identical but for case either.
Base URIs are specified using the <BASE> element. Base URIs allow you to reduce the amount of typing that you have to do - instead of:
you would have:
<A href="foo.html"><IMG src="foo.gif"></A>
Thus you simply put the reference of the base URI from which all others are interpreted and you can reduce typing.
That's the end of this part of the HTML guide. The next section considers essential concepts, things such as how to refer to characters like < so I suggest you click here to continue.