Links

Links are the heart of the World Wide Web. Links are what made the web popular--you can so easily jump from one page to another. Links can be text or images; with special coding, even table cells can be links.

The link command is simple: "a". That's it, one letter. Like the FONT and IMG commands, by itself it won't work; you need at least one attribute, "href" (the "hypertext reference"), which describes where the link will take you. An example of a link command would be:

<a href="page2.html">

If the reference, shown above in red, is a simple filename, such as above, then the link will go to a web page located in the same folder.

If the reference is a full URL, then it can jump to any page on any web site:

<a href="http://blogd.com/wp/index.php/archives/3749/">

Notice that the above link does not specify an HTML file, but a folder. In filename addresses, a slash means a folder. If the link ends in a "/", then it is pointing to a folder. When a browser is directed to look in a folder, it automatically seeks out the "index" file (usually "index.html"). Otherwise, it will give a "directory (folder) listing" of files, or it will return an error.

Link Attributes:

Attribute
Value(s)
Explanation
href=
"filename" or "URL"
Tells the browser which file to jump to.
target=
"_blank"
Makes the linked file open in a new window or tab.

 

Use the link commands in the exercise window below. If you click the links you make, they will appear in the lower part of the window. Try using the attribute target="_blank" to make the link open in an new window or tab. Don't forget the underscore before the word "blank".



 



 



Video Review