public knowledge blog_load(sender Virendra)

                                                                                                                          Nothing shocks me, I am a Software Engineer.

Alternate text for images for different browsers

Posted by Virendra Dugar on January 23, 2009

To show any image on the webpage either img tag is used or <asp:Image> tag is used. We also put some alternate text for the image which is displayed when mouse is over the image.  It works as a tool tip.

To show alternate text on the image we use
alt” attribute for img tag .
Alternatetext” attribute for asp:Image.

But the funny side of these attributes is they are not supported by Firefox. If you use any of these attribute to show alternate text then alternate text is not displayed in Firefox.

After some hard work I found a common solution which is supported by most browsers. Solution is to use ” title” attribute instead of “alt” attribute. This attribute is supported by all the browsers.
<img src=”sunset.jpg” title=”Image1″> </img>

So if you are making browser independent application, stop using alt attribute and switch to title attribute.

Enjoy.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: