alt attribute | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

alt attribute

what does it mean "In case the image cannot be displayed, the alt attribute specifies an alternate text that describes the image in words. The alt attribute is required." I tried to delete a letter from the src and I wrote the word "tree" between the quotation marks of *alt* but nothing appear. So, where am I wrong on this?

10th Jul 2018, 1:25 PM
Alessandra C
Alessandra C - avatar
11 Answers
10th Jul 2018, 1:30 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 3
when the image is not displayed it shows the text between " " check this out https://code.sololearn.com/W6Lg9TRexugt/?ref=app
10th Jul 2018, 1:30 PM
Goku
Goku - avatar
+ 3
Goku this I mean... alt cannot be the only one with a word to find the image
10th Jul 2018, 1:36 PM
Alessandra C
Alessandra C - avatar
+ 3
Mert Yazıcı but with or without the word "smiley face" in the attribute alt you can be able to find the image smile.gif in this case...
10th Jul 2018, 1:37 PM
Alessandra C
Alessandra C - avatar
+ 3
Alessandra C sometimes images cannot be displayed due to various reasons like browser problem ... at that time it is useful... as a backup... also I cannot understand what u said... Goku this I mean... alt cannot be the only one with a word to find the image
10th Jul 2018, 1:39 PM
Goku
Goku - avatar
+ 2
Goku sorry for my English 🙈 what i want to say is that you must to put *alt=""* but you don't need to write something in, do you? also, you cannot leave the src empty and write something only on alt.... 🤔🙄
10th Jul 2018, 2:07 PM
Alessandra C
Alessandra C - avatar
+ 2
Alessandra C Suppose that you have an image at mysite.com/image.jpg then in HTML: <img src="http://mysite.com/logo.jpg" alt="MySite Logo" /> If somethin prevent your browser from load image file, then alt text (if any) will be showed INSIDE img element BUT if img elemenr is small, you cannot see the alt text. If you dont want image, dont use img element
10th Jul 2018, 2:15 PM
KrOW
KrOW - avatar
+ 2
ok... thanks guys for your help :)
10th Jul 2018, 2:17 PM
Alessandra C
Alessandra C - avatar
+ 1
Alt text is not visualized because your img element is small... Try to set a larger width/height and you will see
10th Jul 2018, 1:53 PM
KrOW
KrOW - avatar
+ 1
This still makes no sense to me. Please help!
1st Aug 2018, 8:19 PM
Girl Genius07
0
code?
10th Jul 2018, 1:32 PM
KrOW
KrOW - avatar