- 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
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 )