Lab: Images in HTML
Estimated Time for Completion: 15 minutes
Prerequisite Knowledge:
To gain the most from this lab, you should have familiarity
with:
- Using a text editor (such as NotePad or vi) and performing common file operations
(such as saving and copying files).
- HTML coding for images.
Files:
For this lab, you will need:
Getting Started:
Now you will apply what you have learned about making images accessible in
building an accessible HTML document that contains an image that needs a long
description.
To begin:
- Open your preferred web authoring software.
- Open or create an HTML document.
For this example, open the document: MakingImages.htm.
- Documents should always have an appropriate title, enter the desired title
of the document between the
<title> tags.
For this example, the title should be: Making Images Accessible.
- Add an image to the document using the
<img>
tag with the "src" attribute set to the location and filename of
the image.
For this example, add the image: driving_map.gif.
- Add a brief text description to the
<img>
tag using the "alt" attribute.
For this example, the alternative text should be: "Driving directions
to Jane's house."
- In this example, a long description is needed.
- Open or create a new HTML document for the long description.
For this example, open the document: directions.htm.
- Enter the desired title of the document.
For this example, make the title: Driving Directions to Jane's House.
- Type in the long description into this new HTML document.
For this example, the long description has already been entered.
- Save this HTML document with the long description and remember the filename.
- Return to the the URL (filename) to the "longdesc" attribute
of the image
- In addition to the "longdesc", you also need to provide a description
link just below the image.
- Create an "a href" tag just below the image tag
- The hyperlink reference ("href") attribute should point to
the same HTML document that you created in step 6 of this process (the
"longdesc" page)
- The content of the "a href" tag should be "[D]"
- Close the tag using "
</a>"
- Save your work and open your newly-created web page in a web browser.
Code sample of the "makingimages.htm" file:
<img src="driving_map.bmp" alt="Driving directions to get to my house"
longdesc="directions.htm">
<a href="directions.htm" title="Driving Directions">[D] </a>
Code sample of the "directions.htm" file:
<p>
To get to my house, take I-75 north; exit at Alice Rd. and turn right at the
exit ramp. At the first light, turn left onto Rex Lane and drive for 1/2 a
mile. Turn right onto Maple; my house is the fifth on the left - 123
Maple.
</p>
Browser view of the "makingimages.htm" file:
[D]
Note: The visual sample above
contains the driving_map image and the description link (the "D" after
the image).If you move your mouse over the image and leave it there momentarily,
the "alt" text will be displayed. If you follow the description link,
you will be taken to an HTML page that displays the longer description of the
image.
The next page presents information on Cascading Style Sheets.