HTML alt Attribute

❮ HTML Attributes

The alt attribute with an <img> element.

Example

<img src="demo/image.jpg" alt="demo" width="300" height="200">

The alt attribute with an <input> element.

Example

<input type="image" src="demo/submit.jpg" alt="Submit" width="50" height="50">

The alt attribute with an <area> element.

Example

<img src="img/desk.jpg" usemap="#image-map">

<map name="image-map">
    <area target="_blank" alt="Computer" title="Computer" href="img/computer.png" coords="365,99,905,783" shape="rect">
    <area target="_blank" alt="Cup" title="Cup" href="img/cup.png" coords="1047,672,97" shape="circle">
    <area target="_blank" alt="Mobile" title="Mobile" href="img/mobile.png" coords="960,385,1040,541" shape="rect">
    <area target="_blank" alt="Book" title="Book" href="img/book.png" coords="175,426,96,527,20,664,232,755,298,628,364,505" shape="poly">
</map>

Meaning

The alt attribute specifies alternative information for an image if a some reason cannot loaded by browser.




Standard Syntax

<element alt="text">



Browser Support




Status




Applies to:

The alt attribute can be used on the following element:

Element Attribute
<area> alt
<img> alt
<input> alt






Attribute Values

Value Description
text Specifies an alternate text for an <area>, <img> and <input> elements.
❮ HTML Attributes