Easy Tutorial
❮ Jsref Regexp Constructor Prop Textarea Rows ❯

Image alt Attribute


Definition and Usage

The alt attribute sets or returns the value of the alt attribute of an image.

The alt attribute specifies the alternate text to be displayed when the image cannot be displayed (due to slow internet connection, broken link, etc.).

Note: Internet Explorer displays tooltip text when the mouse hovers over the img element, which is non-standard according to HTML specifications. All other browsers only display the alt text when the image cannot be displayed.

Tip: If you want to create a tooltip for an image, use the title attribute.

Syntax


Browser Support

All major browsers support the alt attribute.


Example

Return the alternate text of an image:


❮ Jsref Regexp Constructor Prop Textarea Rows ❯