What is HTML alt Attribute?
HTML, HTML Attributes 0 CommentsThe 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 | |||||
---|---|---|---|---|---|
area | Yes | Yes | Yes | Yes | Yes |
img | Yes | Yes | Yes | Yes | Yes |
input | Yes | Yes | Yes | Yes | Yes |
Leave a Reply