HTML alt attribute

Html alt attribute defines alternative text when the image is not available. The image may not be available due to wrong address of image or network error.

Example

<p>When the image is not visible in the browser due to wrong source</p>
<img src="files/web.png" alt="Here is image" width="300"/>
<img src="files/eb.png" alt="Here is image" />
Try </>

alt attribute values

The value of alt attribute is simply plain text.

Related Tags

The tags that support this attribute are as follows.

<area> tag

If the image is not present in the linked area, then alternate text appears.

Example

<img src="files/three images.jpg" usemap="#shapes" alt="two shapes of square, circle" />
<map name="shapes">
 <area alt="circle" href="circ.html" shape="circle" coords="196,89,33" />
</map>
Try</>

<img> tag

Example

<img src="files/logo.png" alt="codingb logo" width="200" height="100" />

Try</>


Was this article helpful?

 

Email:

Message:

Get the newsletter