What is the use of "alt" attribute in <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" attribute in <img>tag?

I am new in html, help me out please!

5th Jan 2021, 10:25 AM
Vishu
Vishu - avatar
3 Answers
+ 4
When the image is taking too long to load or not loading, the text in alt attribute will display in the screen. alt - - > alternative For example: <img src="image.png" alt="Image"> In case the image.png is not a valid file or still loading the "Image" text will be displayed. For other answer, see this: https://www.sololearn.com/Discuss/1155929/?ref=app
5th Jan 2021, 11:11 AM
noteve
noteve - avatar
+ 3
alt is the attribute of <img> tag. This represents the alternative text that shows in place of the image if in case image is not loaded for some reason. Example:- <img src="tree.jpg" alt="This is tree" height=500 width=500 />
5th Jan 2021, 1:43 PM
Aditya
Aditya - avatar
0
Ok
5th Jan 2021, 11:11 AM
Vishu
Vishu - avatar