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

What is the role of alt attribute in img tag??

21st Jul 2017, 12:52 PM
Himanshu Sharma
Himanshu Sharma - avatar
5 Answers
+ 3
The requiredĀ altĀ attribute specifies an alternate text for anĀ image, if the imageĀ cannot be displayed. TheĀ alt attribute provides alternative information for anĀ imageĀ if a user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).
21st Jul 2017, 1:03 PM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar
+ 2
If the image cannot be displayed it will instead print the alt (alternative).
21st Jul 2017, 12:57 PM
Victor Fernandez
Victor Fernandez - avatar
+ 2
when image will not load in browser the value of alt attribute text will show at the place of image
21st Jul 2017, 12:59 PM
Akhilesh
Akhilesh - avatar
+ 1
@victorfernandez sir if I need picture of trees then what could be the possible alternative for that??
21st Jul 2017, 1:00 PM
Himanshu Sharma
Himanshu Sharma - avatar
0
alt attribute gives the alternative name for image
21st Jul 2017, 1:15 PM
ch.chitti srilakshmi
ch.chitti srilakshmi - avatar