Writing HTML | About | FAQ | Alumni | Tags | Index | back | next |

8e. HyperGraphics

Text does not have a monopoly on being "hyper"... expand the versatility of your web pages by having pictures act as hyperlinks.

Objectives

After this lesson you will be able to:

Lesson

Note: If you do not have the working documents from the previous lessons, download a copy now.

A HyperLink Button

From the previous lessons, you have (hopefully) become comfortable with creating hypertext, text within your documents that connects a viewer to related information. You can also use inline images (see Lesson 7a) to act in a "hyper" manner. If you recall, in an earlier lesson we linked some text in our Volcano Web page, index.htm, to a second page, msh.htm, that described Mount St. Helens. Now in the latter page, we want to add a button that when clicked will link a reader back to the main lesson page.

The way to do this is to put the HTML tags for inline images within the hypertext portion of the anchor tag:

   <a href="fileX.htm"> <img src="graphic.gif">
   Go to Document X</a>
In your web page, this HTML will display an inline image and the text Go to Document X. Both will act as hyperlinks; clicking on either the text or the picture will tell your web browser to go to the HTML file fileX.htm. The image alone could be a hyperlink. In the World Wide Web, a "HyperGraphic" generally is surrounded by a colored box matching the color of hypertext on your web page, so you know that it is "active".
NOTE: Many browsers now can alter the color of hypertext and some pages have suppressed the display of the outline around HyperGraphic links. Generally, you can identify a hyperlink area on a web page by looking for a change in the cursor as it passes over a "hot" region.

From a design standpoint, we recommend that if you use pictures to act as hyperlinks that you offer also a text link or use the ALT= attribute in the <IMG...> tag in case the viewer has turned off the loading of images.

Now we will create a "hyper" graphic button. First, you need to get a copy of this arrow button:
--
If you need help for saving image files, see the reference page on downloading. When you are ready, view and save the arrow button GIF file as a file named left.gif.

You should now have a copy of the file somewhere on your computer (You should move it to the pictures folder/directory).

Next, add the HTML to make the button work:

  1. Open the second HTML file, msh.htm in your text editor.
  2. At the bottom, modify the last line to:
    <hr>
    <a href="index.htm"> <img src="../pictures/left.gif"> 
    Return to <i>Volcano Web</i></a>
    
    Note: The inline image tag (<img...>) is completely within the anchor between the > that marks the end of the URL and the </a> that marks the end of the hyperText. Also note how the <i> tag is used within the active hypertext to emphasize the title of the lesson. And finally, we have used the <hr> tag to put a hard rule or a line above the button graphic (for more on this tag see lesson 4).
  3. Save the HTML file.
  4. Return to your web browser, and select Open Local from the File menu to read in the "msh.htm" file.
  5. Select Reload from the File menu to update the changes.
  6. Test the hyperlink to the Mount St. Helens page and the new button that should return you to the Volcano Web page.

"Postage Stamp" Images

Previously, we advised against using large inline images in your web pages because viewers might wait a long time for images to download to their computer. One way around this is to create miniature size copies of the graphic, or "postage stamps" which are displayed as inline graphics. Then, using the same steps as above, you can make the "postage stamp" image act as a hyperlink that links to the full size image. In this way, the large images are downloaded only if the viewer decides to see it.

We will now add a postage stamp image that links to a larger picture: If you would like, first preview the postage stamp GIF image and the Full size JPEG image.

First, you need to get a copy of the two image files. If you need help on saving graphics files, see the reference page on downloading. When you are ready, save the postage stamp GIF image as a file called "stamp.gif" and the Full size JPEG image as a file called seismo.jpg These files shouls be stored in your pictures folder/directory.

Next, create the postage stamp link in your main text file:

  1. Open the index.htm file in your text editor.
  2. Under the heading Long Valley enter the following:
      This field seismometer measures earthquakes associated 
      with subsurface volcanic forces and may help to predict 
      future events. It sits on a plateau known as the "Volcanic 
      Tableland" formed by a major eruption  600,000 years ago.
      <p>
      <a href="../pictures/seismo.jpg"> <img src="../pictures/stamp.gif">
      -- [full size image] -- </a>
      <p>
      This seismometer measures earthquakes 
      associated with subsurface volcanic forces.
    
    The inline image, stamp.gif acts as a hyperLink to a larger image, seismo.jpg. When a user clicks on either the "postage stamp" or the text "Click to view full size image --", your web browser will display the larger image in an external window or in a blank page.
  3. Save and Reload in your web browser.

Check Your Work

Compare your web page with a sample of how this document should appear. If your web page was different than the sample, review the text you entered in the text editor. Some of the more common mistakes are discrepancies between spelling of the file names and the HTML or not having the image files in the same directory as the HTML files.

Review

Review topics for this lesson:
  1. How did you create the graphic button in your web page?
  2. How are "postage stamp" links useful in including graphics in your web page?
  3. How did you create your "postage stamp" link in your document?

Independent Practice

Try to add buttons that links two web pages to each other.

Coming Next....

Use the preformat tag to create a table of text in your Volcano lesson.
GO TO.... | Lesson Index | back: "Named Anchors" | next: "Preformatted Text" |

Writing HTML Lesson 8e: HyperGraphics
©1995 Maricopa Center for Learning and Instruction (MCLI)
Maricopa County Community College District, Arizona

The Internet Connection at MCLI is Alan Levine --}
Comments to levine@maricopa.edu

URL: http://www.mcli.dist.maricopa.edu/tut/tut8e.htm