What is the use of alt in the img tag | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What is the use of alt in the img tag

what is the difference when alt is use in the IMG tag and alt tag is not use in the IMG tag

16th Jan 2017, 5:17 PM
Vani Vijaya
Vani Vijaya - avatar
1 Answer
+ 3
"alt This attribute defines the alternative text describing the image. Users will see this text displayed if the image URL is wrong, the image is not in one of the supported formats, or if the image is not yet downloaded. Browsers do not always display the image referenced by the element. This is the case for non-graphical browsers (including those used by people with vision impairments), if the user chooses not to display images, or if the browser cannot display the image because it is invalid or an unsupported type. In these cases, the browser may replace the image with the text defined in this element's alt attribute. You should, for these reasons and others, provide a useful value for altwhenever possible. Omitting this attribute altogether indicates that the image is a key part of the content, and no textual equivalent is available. Setting this attribute to an empty string (alt="") indicates that this image is not a key part of the content, and that non-visual browsers may omit it from rendering." ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img )
16th Jan 2017, 6:22 PM
visph
visph - avatar