Hyperlinks in HTML documents.

Hyperlinks are the mechanisms that allow you to weave the internet into a World Wide Web.  The HTML tag pair to add a hyperlink is  <a href="file_name">

The HTML tag used to form a hyperlink to another document, is the anchor tag. To create a link in HTML, you need two things:

  1. The name of the file (or the URL of the file) you want to link to.
      
  2. The text that will serve as the "hot spot" - that is, the text that will be highlighted in the browser, which your readers can then select to follow the link.  Only this second part is actually visible on your web page.  When your readers select the text that points to a link, the browser4 uses the first part as the place to "jump" to.

Examples:

  1. When the linked too file is in the same folder <a href="file_name">Text Label</a>     
     
    <a href=“contact.htm”>Contact me</a>
         As displayed on a web page, this html code will appear as:  Contact me

     
  2. When the linked too file is located on the same machine, but in a different folder on that machine:
      <a href="directory_folder/file_name">
    Text Label</a>
      
     <a href="../assignments/W08/favoriteAsg.htm">
    Assignment #2</a>   ==>   Assignment #2
      
  3. When the linked too file is somewhere else on the WWW:
          <a href="http://packard.csesp.umflint.edu/~hickslm/263/index.html">263 Syllabus</a>  ==>     263 Syllabus

    In addition to linking to other html documents, you can link to files of other types, which are known by browsers, such as:

    Linked to File Type HTML tag
    Big List of HTML tags,
    in Adobe pdf file format. 
    <a href="web-page-tags.pdf">Big List of HTML tags</a>
    File of PowerPoint Presentation Slides on HTML hyperlinks. <a href="hyperlinks.ppt"> HTML hyperlinks</a>
    Link to a gif image, named teacher2.gif <a href="teacher2.gif">teacher2.gif</a>
    Link to an photograph file in jpg format
    Linda's First Grandchild
    <a href="AlexGrandma.JPG">Linda's First Grandchild</a>
    Link to a sound file. <a href="HTMLfun.au">sound file</a>
    Link to a Shockwave Flash Movie <a href="http://packard.csesp.umflint.edu/~hickslm/263/flash/smartFTPdemo_skin.swf">
    Shockwave Flash Movie</a>

    Note in the first five examples the linked to file was contained within the same folder as the document containing the link.  Also note that the names of the files are spelled exactly as written following the href property.  (Capital letters are different from lower case letters.)

    The last example, uses an absolute url, to link to another location.

    [top]

    This page was last updated on 01/23/2008 by L.M. Hicks