+ 1
what is the role of alt=""
<img src="tree.jpg" alt="" />
4 RĂ©ponses
+ 4
Hello, Firas Hajji !
The alt attribute sets the alternative text for images. This text allows you to get text information about the image when the download of images is disabled in the browser. Since images are downloaded after the browser receives information about it, the text replacing the picture appears earlier. And already as you load the text will be replaced by the image.
By the way, pay attention to the lesson from SoloLearn.
https://www.sololearn.com/learn/HTML/1030/?ref=app
+ 3
Just wanted to add some... Also it is useful for the accessibility. Blind people using screen readers can get information about images on web-pages. And one more, also this information could be easily acquired and used by some bots/parsers/other types of automation (tools).
+ 1
If the userâs internet connection is slow/nonexistent or something else makes the image not load, alt=ââ will display text to describe the image or convey a message such as âThe image failed to load.â. For example:
<img src=âAwesome_wolf.jpgâ alt=âAwesome wolf picâ
</img>
This will display the image named âAwesome_wolfâ, but if the image does not load, the text âAwesome wolf picâ will be displayed instead.
(Wolves are my favorite animal)