alt attribute | Sololearn: Learn to code for FREE!

+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?

7/10/2018 1:25:12 PM

Alessandra C

11 Answers

New Answer

+5

https://www.w3schools.com/tags/att_img_alt.asp

+3

when the image is not displayed it shows the text between " " check this out https://code.sololearn.com/W6Lg9TRexugt/?ref=app

+3

Goku this I mean... alt cannot be the only one with a word to find the image

+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...

+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

+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.... 🤔🙄

+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

+2

ok... thanks guys for your help :)

+1

Alt text is not visualized because your img element is small... Try to set a larger width/height and you will see

+1

This still makes no sense to me. Please help!

0

code?