Html Tips and Tricks

Tuesday, May 18, 2004

Alternative Text for Images

Another tip for image coding in HTML is alternative text. This text shows up in case the graphic does not show up, and also is displayed when the user holds their mouse over an image. Take the Google logo, for example. If I want to display, "This website rocks!" when you hold your mouse over the image, or if it doesn't load, I will use this code:
<IMG SRC="http://www.google.com/images/logo.gif" ALT="This website rocks!">

This gives me this result (drag your mouse over it and hold it still for a few seconds):
This website rocks!

The alternative text will also show up when the graphic isn't coded correctly like this:

<IMG SRC="http://www.google.com/images/logoarughaj.gif" ALT="This website rocks!">

That bad code gives me this:

This website rocks!

As you can see, alternative text is very handy and a good way to manage images.

Also, if you can't get an image to come up, make sure you have http:// written at the beginning, not just www.!

NOTE FROM NILS: Some of the information shown above may not work on some browsers exactly as described. The information above is accurate for Internet Explorer, however.


NEED EXTRA HELP? HAVE A SUGGESTION? HAVE SOMETHING TO ADD? PLEASE POST COMMENTS WHILE LOOKING AT ALL THESE USEFUL HTML TIPS AND TRICKS. THANK YOU!

1 Comments:

Post a Comment

<< Home


Hit Counter