Links, Anchors, URLs, and Images

LINKS | ANCHORS | URLS | IMAGES

a Link

has the form
<A HREF="URL">Text for link</A>
where URL (the Uniform Resource Locator to which to go) is of the form
Protocol://host.name/directory/filename
or
Protocol://host.name/directory/filename#anchorname
e.g.,
http://brillig.nebrwesleyan.edu/~glarose/dviview.html#otherfonts
In this case, otherfonts is the name of an anchor in the dviview.html document.

A special type of link is the mailto link:

<a href="mailto:email_address">email me!</a>
creates a link that will allow users to send email to email_address.


an Anchor

is defined by
<A NAME="NAME_OF_ANCHOR">Text to go to</A>
For example,
<A NAME="otherfonts">Link to "otherfonts" comes to here</a>
Browsers generally do not display anchors with any discernable characteristic.


URLs and File Systems

[file pic] Suppose that the files on brillig are set up as shown to the right. Then the link
<a href="http://brillig/~glarose/index.html>
links to the file index.html in the directory ~glarose. My server adds "index.html" if it is left off, so
<a href="http://brillig/~glarose/>
means the same thing.

Any part of a link in a document may omit the portion of the URL that is common to the file being linked to and the document containing the link. Thus, in the file index.html the link
<a href="dviview.html">
refers to the file dviview, and the link
<a href="classes/html/">
refers to the file index.html in the directory ~glarose/classes/html/.

Another way of saying this is to say that "incomplete URLs are given relative to the document in which they appear." This also allows a link such as
<a href="../../dviview.html#otherfonts">
in the file index.html in the directory /~glarose/classes/html/ -- because .. means "go up one directory."


Images

Images may be included in a document with the img tag:

<IMG SRC="URL_of_image" ALT="alternate text">

For example, to include the file glr.gif in the file /~glarose/index.html,

<img src="images/glr.gif" alt="picture of me">

The alt attribute is not required but it is good form to include it -- it is the text that is displayed if the browser doesn't display images.


Anchors, Links, URLs and Images
Comments to Gavin LaRose (glarose@NebrWesleyan.edu)
Last modified