English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The input alt attribute provides alternative text for users if the image cannot be viewed due to some reason (slow connection, src attribute error, or the user is using a screen reader). The alt attribute can only be used with <input type=image>.
HTML form, submit uses an image as the "submit" button:
<!DOCTYPE html> <html> <head> <title>HTML:<input> alt attribute - 基础教程网(oldtoolbag.com)</title> <body> <form action="action_page.php"> First name: <input type="text" name="fname"><br> <input type="image" src="submit.gif" alt="Submit" width="48" height="48"> </form> <p>Click on the image, the input will be sent to the page named "action_page.php" on the server.</p> <p>Notice: The default behavior of the image input type is to activate the X and Y coordinates of the click on the image button.</p> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the alt attribute.
If for some reason (due to slow connection, src attribute error, or user using a screen reader) the image cannot be viewed, the alt attribute provides the user with alternative text.
Note: The alt attribute can only be used with<input type ="image">.
None.
<input alt="text">
Value | Description |
---|---|
text | Specifies alternative text for an image. |