GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes Using an alt attribute with HTML elements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Using an alt attribute with HTML elements" Watch "Using an alt attribute with HTML elements" New topic
Author

Using an alt attribute with HTML elements

RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528

<img id="myImage" src="image.gif" alt="An image" title="This is an image"/>

The docs says these things but i couldn't get this

Purpose of ALT

“Several non-textual elements (IMG, AREA, APPLET, and INPUT) let authors specify alternate text to serve as content when the element cannot be rendered normally.”

I can't understand what is the use of using an alt attribute .




If you want something you never had do something which you had never done
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Read what the w3c sayys about it: http://www.w3.org/QA/Tips/altAttribute

Eric
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
RaviNada Kiran wrote:
I can't understand what is the use of using an alt attribute .


The reason you use an alt attribute is to prevent parts of your pages appearing missing if someone comes to your site that can't view certain things. If someone has their browser configured to not show text or applets then instead of a giant missing area you can put text there like, "Enable Applets to view this content" or something like that.

HTH


SCJA
~Currently preparing for SCJP6
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using an alt attribute with HTML elements