Building Links to HTML Files

Links are built using the HREF attribute with the anchor tag. HREF must be assigned some value, a target value for a destination. The target can be within the same document, another document on the same server (filename), a document on a different server (URL), or a portion of text in another document.

<A HREF="#SGML">More information about SGML</A>
provides a link to a target named SGML in the current document.

<A HREF="http://scholar.lib.vt.edu/html-intro.html">More information about HTML</A>
links to a document called html-intro.html on the World Wide Web.

<A HREF="http://scholar.lib.vt.edu/html-intro.html#SGML">More information about SGML</A>
links to a target named SGML in a file called html-intro.html on the World Wide Web.

Finally, an anchor can be both a link and a target:

<A NAME="SGML2" HREF="#SGML">if you are still lost</A>
can be pointed to with the name SGML2 and points to a target called SGML.

Any value assigned to an attribute must be enclosed by double quotes.


Next Slide