0
What is the use of alt=""/
4 Answers
+ 3
Answers are right, but precisions:
It's not exactly: alt=""/
You may found this sample in a <img> tag element, probably like that: <img src="path_to/image_file" alt=""/>
Well, each left part of an equal sign ( = ) is named an attribute, and the double quotes are delimiter for the value assigned to the attribut. So alt="" is for purpose indicated in older answers, but in this isn't filled ( quiet like no attribut all at all -- but it's more valid html5 than without ): the "alternate text" represented by this attribut is simply nothing, so it don't provide any help for bind people or broken image ).
Finally, what's this ending slash ( / ) want you ask me?
It's the shortener closing tag in XML specification: for the tag who don't use any content ( img, which set the image url in the src attribut, br, hr... ), you theoricaly must close your tag like this: <img></img> But as all the time you nerver put data in between, a shortener syntax is <img />. This shortener syntax is required in XML file, so in XHTML. But in HTML it's just accepted, but not needed: the specials tags which have never contents not required ;)
0
Or if the browser pf someone cannot show the image the alt text will be displayed instead
- 1
It is used for blind people who use screen readers. For an <img> with a cat photo put alt="Photo of cat" in your code. The screenreader will read this and the person using it will know about the images an your page.
- 1
Okay thank you