0
<img src="http://www.sololearn.com/images/tree.jpg" alt="" />...in this command what is the use of alt="" ????
alt=""
6 odpowiedzi
+ 3
In the img tag alt is used to display an alternate 'thing' in case your image is unable to load properly due to whatever reason. This alternate 'thing' is in the form of text which describes what was the image all about. In your case it's tree.jpg so if it fails to load then whatever is written in the alt attribute will show up and if you had also left alt blank like in your defined question then the icon of the broken image will show up.
For a good web designer its always necessary to define alt attribute as it comes as a minimal Savior in case your image fails
+ 1
<img src="tree.jpg"
height="200px" alt=""
width="500px"/>
0
when your mouse cursor hover the image a small text show near cursor and show message that you type it.
0
@Aditya kumar Pandey that small box with text appears due to title attribute and not alt attribute. Title attribute is used to define a short description of what the link is all about and that works after the element is fully loaded in which the title attribute was used. In contrary alt attribute is used as a substitute of failed image and that's why it will only work once the element that is the image fails to load.
0
thanks shivani..answer was very comprehensive and understandable..
0
That "alt" altribute displays the NAME of that image, if the original image can't able to load.