What is "alt =" used inside img tag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is "alt =" used inside img tag?

31st Jul 2019, 2:02 PM
Pooja Vibhute
3 Answers
+ 1
Incase if the image does not load, the text in alt= is displayed e.g alt="pic of a dog". "Pic of a dog" (consider that image did not load)
31st Jul 2019, 2:10 PM
Muhammad Shehzad
Muhammad Shehzad - avatar
+ 2
Stands for alternative, if the browser cannot display the image it shows text instead. All your imgs should have alt attributes, in case the image doesn't load, end user will still know what's missing. <img src="cat.jpg" alt="Cat's face">
31st Jul 2019, 2:09 PM
HNNX 🐿
HNNX 🐿 - avatar
+ 1
When the correct image written in image tag does not displayed on screen then alt= is diaplayed. in other words alt= is used for displaying error messages.
22nd Aug 2019, 5:40 AM
Maria Batool
Maria Batool - avatar