Simple Hypertext Links
The anchor (<a>) tag is used to identify a
string of text or an image that serves as a
hypertext
link
to another document. Linking to a string of text looks like this:
I am <A HREF="link.html">linking</A> to you!
To make an image a link, enclose the image tag within the anchor tags as follows:
<A HREF="link.html"><IMG SRC="pixie.gif"></A>
Most graphical browsers display linked text underlined and in blue by
default, but this behavior can be altered. Linked graphics appear
with a blue outline (unless you turn the outline off in the
<img> tag by setting the border attribute to
zero).
The URL is the pathname of the document you want to link to. URLs can be absolute or relative.
Absolute URLs
An absolute URL is made up of the following components: a protocol identifier, a host name (the name of the server machine), and the path to the specific filename. When you are linking to documents on other servers, you need to use an absolute URL. The following is an example of a link with an absolute URL:
<A HREF="http://www.littlechair.com/web/index.html">...</A>
Here the
protocol is
identified as http (HyperText Transfer Protocol,
the standard protocol of the Web), the host is
www.littlechair.com, and the pathname is
web/index.html.
Relative URLs
A relative URL provides a pointer to another document relative to the location of the current document. The syntax is based on pathname structures in the Unix operating system, which are discussed in Chapter 4. When you are ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access