linking | ![]() |
![]() |
![]() |
One of the strongest points in HTML is the hypertext part, which allows the dynamic reference in a web page to an object that may be located anywhere on the web. Although this mechanism is sometimes abused, it allows a far greater inpact of the material you present, since it provides a very flexible reference mechanism. To add to this, the way these hypertext links are implemented is extremely easy to handle.
links | ![]() |
![]() |
![]() |
Inserting a link to another object is done using the <A> tag. The sole argument you provide is HREF, in which you put the URL of the object you want to link to. Of course the link is a container tag, since the viewer must have something to select. Any material between <A> and </A> is marked up as a link, so make sure that at least part of it is visible.
Nesting of tags inside links is not officially supported by the specifications, and may cause problems in the presentation of your material.
Always write URLs between double quotes.
anchors | ![]() |
![]() |
![]() |
As was shown in the basics section, a URL can contain an anchor to a specific location in a document. These are used to jump straight to that location, which is useful if you have large texts. The jump to an anchor is done by appending a # and the name of the anchor to the URL of the document, but the document must of course define this anchor. This is also done with the <A> tag, but this time the attribute is NAME, in which you set the (unique) name for the anchor. In contrast to the HREF attribute, no content is required between <A> and </A>, and if you do insert visible content, it will not be marked up differently from the surrounding material.
As an example, the introductory text to this course is included in the index file, and has an anchor
<A NAME="intro">intro</A>defined inside its header. As a result, it's possible to jump straight to the intro using something like
<A HREF="course/index.html#intro">intro</A>
which appears as intro. Also note the use of a relative URL, which is possible since the <BASE> tag in the header of this page contains
<BASE HREF="http://www.geo.uu.nl/~loohuis/">
mailto | ![]() |
![]() |
![]() |
One exceptional protocol is used by the mailto link, which is identical to a regular link, but the HREF is set to contain the word mailto: and an email address. Again, the tag must contain something visible to select, and often the email address is repeated, to indicate the special nature of this link. The response of the browser to its selection is to launch a mail client, and pass it the email address in the link. As an example, the insertion of
<A HREF="mailto:loohuis@geo.uu.nl">loohuis@geo.uu.nl</A>in this page would look like loohuis@geo.uu.nl, and if you select it, you can send me email.
I will not guarantee that any of these pages will exist indefinately, so please only bookmark the top page. |