0

<img src="http://www.sololearn.com/images/tree.jpg" alt="" />...in this command what is the use of alt="" ????

alt=""

6th Nov 2016, 2:22 PM
itsme SAP;)
itsme SAP;) - avatar
6 ответов
+ 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
6th Nov 2016, 2:54 PM
Shivani
+ 1
<img src="tree.jpg" height="200px" alt="" width="500px"/>
4th May 2018, 10:18 AM
Mahnoor Shahzad
Mahnoor Shahzad - avatar
0
when your mouse cursor hover the image a small text show near cursor and show message that you type it.
6th Nov 2016, 2:49 PM
KiynL
KiynL - avatar
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.
6th Nov 2016, 3:00 PM
Shivani
0
thanks shivani..answer was very comprehensive and understandable..
6th Nov 2016, 3:03 PM
itsme SAP;)
itsme SAP;) - avatar
0
That "alt" altribute displays the NAME of that image, if the original image can't able to load.
8th Jan 2019, 10:07 AM
AJINEESH AJI
AJINEESH AJI - avatar