Tutorials Exercises Get Certified Services Menu
Log in
Sign Up Spaces Bootcamps

HTML <input> alt Attribute

❮ HTML <input> tag


An HTML form with an image that represents the submit button:

<form action="/action_page.php">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname">
  <input type="image" src="submit.gif" alt="Submit" width="48" height="48">
Try it Yourself »

Definition and Usage

The alt attribute provides an alternate text for the user, if he/she for some reason cannot view the image (because of slow connection, an error in the src attribute, or if the user uses a screen reader).

Note: The alt attribute can only be used with <input type="image">.

Browser Support

alt Yes Yes Yes Yes Yes


<input alt="text">

Attribute Values

Value Description
text Specifies an alternate text for the image

❮ HTML <input> tag