One-Hour HTML Tutorial

Lesson 6: Creating Links

You use the <A></A> tags to create a link to another HTML page. The attributes are:

    HREF              - This is the file name of the target page
                        (use path if in a different directory
    NAME              - This is the part of the page you want to go to
    HREF=mailto:email - This is used to open a new email message

NOTE: You can can link both text and images. You can link to local pages or websites on the internet.

See examples below

Code (in text editor)Display (in web browser)
<A HREF=ex01.html>Click Me!</A> Click Me!
<A HREF=http://www.ptcruser.com>
<IMG SRC=ptcruisr.jpg WIDTH=256 HEIGHT=153></A>

Directory Paths

Sometimes the files you want to link to are not in the same directory.

  • If the target file is in a subdirectory below the calling file:
    <A HREF="subdir/target.html">

  • If the target file is a directory above the calling file:
    <A HREF="../target.html">

  • If the target file is a directory besides the calling file's directory:
    <A HREF="../directory/target.html">

NOTE: This syntax also works for calling other files (e.g. graphic files using the <IMG> tag).

 


by Robert Dolores