Back so soon? O.K. let's get on with the lesson.
Named Anchors
Hyperlinks can be used to move the browser to a specific place in a
document by using the NAME attribute, which is used to set up named
anchors. The enclosed text will be marked as a target
to which a browser can jump directly much like a bookmark in word
processing.
I used this attribute in the link back from Dummy Link 2 above.
Notice how it returned to the "Back so soon? O.K. let's get on
with the lesson." line above? Here is the code for that line:
<P><A NAME="back">Back</A>
so soon? O.K. let's get on with the lesson.
And here is the code used in Dummy Link 2:
<P>This is a <A HREF="../chapter7.html#back">Link</A>
back to the page you just came from.
Notice that in the link, a # must be used before the name of the
section, but in the named anchor, no # is used. You can also use
this in the current document like this:
<P>This is a <A HREF="#back">Link</A>
back to the cited line.
This is a Link back to the cited line.
Linking to Other Web Sites
The links that we've been using as examples all link to files that are
located on the same server, so you can access them using directory names.
These are called relative pathnames because they are all
relative to the current document. Whenever possible, use relative
pathnames in your own files. It makes it easier to move groups of
files from your computer to your web server host. Don't put the
Drive and Home Directory from your computer into the hyperlinks (absolute
pathnames), they won't work correctly once you move the files to
your web server host.
Now that we've gotten that out of the way, how about links to other
sites on the Web? For this you will use absolute
pathnames, but instead of Drive letters you will use the sites
URL.
For example, if you wanted to link to this guide, you would write:
<P><A HREF="http://www.freenettools.netfirms.com/tutorials/
lessoni2.html">Your First Home Page</A>
Easy, Huh? There are a few more attributes to the
<A> tag that are not so widely supported.
I won't go into any detail here, check my
Resources page for links to more detailed references to HTML.
|