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 - 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
alt attribute gives the alternative name for image
21st Jul 2017, 1:15 PM
ch.chitti srilakshmi
ch.chitti srilakshmi - avatar