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.