What does alt attribute mean | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does alt attribute mean

alt

16th Nov 2016, 4:29 PM
Gianne Ramos
6 Answers
+ 2
the alt attribute contains text, wich will be displayed if the image could not be loaded.
16th Nov 2016, 4:31 PM
jmey
+ 2
@Gianne: I tried it in a view browsers. If you write it like Sommath, you will get the alternative text e.g. in Opera. In Safari I don't get the alternativ text. Don't know what about Firefox or IE... Long story short: the code is correct, but it depends on the browser you use. I published a sample code, so you could test it if you want.
16th Nov 2016, 8:13 PM
jmey
0
i tried putting an invalid img source. y did the alt attribute text value wasnt shown?
16th Nov 2016, 4:36 PM
Gianne Ramos
0
well it is an attribute inside img tag <img> its use is when your image couldn't load in a certain condition then the text inside <img src=pic.jpg alt="the image couldn't load"> output - the image couldn't load. will be displayed
16th Nov 2016, 6:57 PM
Somnath Pandey
Somnath Pandey - avatar
0
Thank you @jmey ! :)
17th Nov 2016, 2:14 AM
Gianne Ramos
0
As jmey wrote but it also helps with SEO (search engine optimization)
29th Nov 2016, 12:15 PM
Jonathan Kiaei