What is HTML alt Attribute?

HTML, HTML Attributes , 0 Comments

The alt attribute provides alternative information for an image if it can not be viewed by a viewer for some reason (because of a poor link, a mistake in the src attribute, or using a screen reader by the user).

The <img> tag requires the alt attribute.

In <input> elements, the alt attribute can only be used for <input type="image">.

Tag Support

You can use alt attribute in <area>, <img> and <input> tags.

Example

<img src="flowers.gif" alt="flowers" />
<img src="food.gif" alt="food" />
<img src="tamato.gif" alt="tamato" />
<!-- If image can't able to load it will show the alt attribute value -->

Browser Support

Element
areaYesYesYesYesYes
imgYesYesYesYesYes
inputYesYesYesYesYes
Spread the love

Leave a Reply

avatar
  Subscribe  
Notify of