Latest web development tutorials

HTML input alt attribute

HTML input Tag Reference HTML <input> tag

Examples

With an image submit button HTML form:

<form action="demo_form.html">
First name: <input type="text" name="fname"><br>
<input type="image" src="submit.gif" alt="Submit" width="48" height="48">
</form>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the alt attribute.


Definition and Usage

alt attribute for a user for some reason (such as speed is too slow, src attribute errors, disable browser images, the user is using a screen reader) provides an alternative text can not view the image.

Note: alt attribute only with <input type = "image"> used in conjunction.


Differences between HTML 4.01 and HTML5

no.


grammar

<input alt="text">

Property Value

描述
text 规定图像的替代文本。


HTML input Tag Reference HTML <input> tag