How to use alt attribute of imgtag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to use alt attribute of imgtag?

3rd Jul 2018, 12:01 PM
Aman Kumar Faujdar
Aman Kumar Faujdar - avatar
4 Answers
+ 5
Hello, Aman Kumar Faujdar ! The <img> tag is used to display images in the GIF, JPEG or PNG image format on a web page. The address of a file with a picture is specified through the attribute src. If necessary, the drawing can be made a link to another file by placing the <img> tag in the container <a>. In this case, a frame around the image is displayed, which can be removed by adding the border = "0" attribute to the <img> tag. Figures can also be used as map images when the picture contains active areas serving as references. Such a map in appearance does not differ from the usual image, but it can be broken into invisible zones of different forms, where each of the regions serves as a link. Syntax HTML <img src = "URL" alt = "alternative text"> XHTML <img src = "URL" alt = "alternative text" /> https://www.sololearn.com/learn/1055/?ref=app https://www.sololearn.com/learn/HTML/1030/?ref=app
3rd Jul 2018, 12:10 PM
Alexander Sokolov
Alexander Sokolov - avatar
+ 2
like Agent mentioned, just include some text. It's used for a few purposes, but mainly for vision impared people using screen readers. It can also help with Search Engine Optimization (SEO).
3rd Jul 2018, 12:13 PM
Duncan
Duncan - avatar
+ 1
Alt defines alternative text that appears if the image does not load This can be empty with no value syntax: <img alt="text"> Example: <img src="house.gif" alt="Red House"> Or <img src="house.gif" alt=""> https://www.sololearn.com/learn/HTML/1030/
3rd Jul 2018, 12:05 PM
Agent
Agent - avatar
+ 1
thanks my friend
4th Jul 2018, 12:42 AM
Aman Kumar Faujdar
Aman Kumar Faujdar - avatar