Creating Links

URL

URL stands for uniform resource locator. It is, simply put, an address that “points” the browser to the location of a specific file. It consists of the protocol, host name (domain name), directory, and filename.

Examples:
http://www.yahoo.com
http://www.hpiweb.com/homepage.html
telnet://apollo.commnet.edu
mailto:jtimmons@hpiweb.com
ftp://ftp.mcafee.com

 

Absolute and Relative Pathnames

An absolute pathname contains all the information (domain name, directories, and filename) of a URL. Use an absolute pathname for links to external documents—an HTML document that does not reside on your own Web site.

Example:
http://www.hpiweb.com/homepage.html

A relative pathname contains only information relative to the original file. Use a relative pathname for internal documents—an HTML document that resides on your own Web site.

Example:
filename.html

 

Creating External Links

<a href="protocol://domain.name/directory/filename">Name of the Link</a>

Example Code:
<a href="http://www.yahoo.com">External Link</a>

The Result:
External Link

 

Creating Internal Links

<a href="filename">Name of the Link</a>

Example Code:
<a href="internal.html">Internal Link</a>

The Result:
Internal Link

 

Creating Anchors

A link to another HTML document, by default, brings us to the top of the HTML document. An anchor allows you to create an internal link to a specific location within an HTML document.

The Anchor:
<a name="AnchorName">Text to Anchor To</a>

The Link to the Anchor:
<a href="URL#AnchorName">Internal Link to the Anchor</a>

Example Code:
<a href="internal.html#Anchor2">Internal Link to the Anchor</a>

The Result:
Internal Link to the Anchor

 

<Emphasizing Text ^Top of Page Lists >

XHTML Basics Workshop
© 1996-2005