HTML <img> alt Attribute
HTML <img> tag
Example
An image is marked up as follows:
| <img src="angry.gif" alt="Angry face" /> |
Try it yourself »
|
Definition and Usage
The required alt attribute specifies an alternate text for an image, if the image cannot be displayed.
The alt attribute provides alternative information for an image if a user for some reason cannot view
it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).
Note: Internet Explorer displays the value of the alt attribute as a tooltip when mousing over the img element. This is NOT the correct
behavior, according to the HTML specification. All other browsers are following the specification, and will only display the alt text if the image cannot be displayed.
Tip: If you want to create a tooltip for an image, use the title attribute.
Browser Support

The alt attribute is supported in all major browsers.
Syntax
Attribute Values
| Value |
Description |
| text |
An alternate text for an image. Guidelines for the alt text:
- If the image contains information - use alt to describe the image
- If the image is inside an a element - use alt to explain where the link goes
- If the image is only for decoration - use alt=""
|
HTML <img> tag
Click here to design a Stunning Flash Website for Free
Wix is a revolutionary web design tool that provides anyone with the possibility to create professional and beautiful websites for free.
With e-commerce features, search engine visibility and many more professional tools, Wix is the ultimate solution for creating a spectacular site while saving tons of money.
|