- img
- area
- input with type="image"
The ALT attribute is designed to be an alternative text description for images.
What are the benefits?
- Enhance the browsing experience of visitors with disabilities.
- If somehow the image is not able to load, then a visitor will see the description of ALT attribute. This will also help when someone is using text based browsers like Lynx.
- By having ALT attribute you are increasing the keyword density which is very good in terms of
Search Engine Optimalisation (SEO).
The alt attribute for decorative images should be empty [alt=""] to meet the accessibility and XHML standards. If you include an empty alt attribute, screen readers will skip over the image. If you don't... the screenreader will read the entire URL of the image, which is quite annoying for the visitor.
What about the ASP.NET image control?
By default, when the AlternateText property is not set, the Image control does not include the alt attribute to specify the alternate text in the control rendering. If you set this attribute to be empty [AlternateText=""] you will notice that the control ignores it too.
Fortunately, since .NET 2.0, the image control contains a GenerateEmptyAlternateText property. It specifies whether or not the control creates an empty string as an alternate text. Set the GenerateEmptyAlternateText property to true to always include the alternate text attribute in rendered output for the Image control.