asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Authoring Your Web Pages > Anchors and Links

Anchors and Links

Previous: HTML Elements   Next: Using Tables


Linking to a document

If the destination is an HTML document that is within the same folder or directory as the source of the link, we can simply write the URI as the target document’s filename:

<a href="intro.html">Introduction</a>

If the destination is an HTML document on a different folder or directory from the source of the link, we need to include the file’s location relative to the link source, or the relative path of the target file, in the URI.

For instance, if the target file is one level up the directory tree from the link source, we would write:

<a href="../intro.html">Introduction</a>

The following examples show how the links of this workshop are organized.

If the target files are on different directories, as in the main links to the chapters of this workshop, we would write:

<ul>
   <li><a href="primer/intro.html">So You Wanna Build a Web Site</a>
   <li><a href="plan/intro.html">Conceptualizing Your Web</a>
   <li><a href="build/intro.html">Authoring Your Pages</a>
   <li><a href="manage/intro.html">Managing Your Web</a>
</ul>

Each of these links retrieves a chapter’s contents page, which provides another set of links to each document available for that chapter. For instance, this chapter’s contents page has these links:

<ul>
   <li><a href="authoring.html">Web Authoring Basics</a>
   <li><a href="htmlintro.html">Understanding HTML</a>
   <li><a href="stylesheets.html">Using Style Sheets</a>
   <li><a href="links.html">Anchors and Links</a>
   <li><a href="frames.html">Frames and Framesets</a>
</ul>

Note that this is similar to the first link example on this page, as the destinations are within the same folder or directory as the source of the link.

If the destination is an external HTML document, located on a different Web server, we need to write the complete URI:

<a href="http://www.w3.org/TR/html401/">The W3C HTML 4.0 Specification</a>

Web Authoring Basics has more information on URIs.


More ...
Back to top


© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note