HTML <input> altAttribute
Example
An HTML form with an image submit button:
<form action="demo_form.html">
First name: <input type="text" name="fname"><br>
<input type="image" src="submit.gif.html" alt="Submit" width="48" height="48">
</form>
First name: <input type="text" name="fname"><br>
<input type="image" src="submit.gif.html" alt="Submit" width="48" height="48">
</form>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the alt attribute.
Definition and Usage
The alt attribute provides alternative text for users when they cannot view the image for some reason (such as slow network speed, an error in the src attribute, the browser disabling images, or the user using a screen reader).
Note:The alt attribute can only be used with <input type="image">.
Differences between HTML 4.01 and HTML5
None.
Syntax
<input alt="text">
Attribute Values
| Value | Description |
|---|---|
| text | Specifies the alternative text for the image. |
HTML <input> Tag Other Extensions