HTML Input Alt Attribute - Dofactory
Có thể bạn quan tâm
The alt attribute on an <input> tag defines alternative text.
This attribute only applies to <input> elements of type image.
Alternative text only shows when the image cannot be loaded.
Example
#
An alt attribute on an <input> element. The image button is loaded correctly, therefore alternative text does not display.
First name Last name <form action="/tutorial/action.html"> <label for="firstname">First name</label><br /> <input type="text" id="firstname" name="firstname"><br /> <label for="lastname">Last name</label><br /> <input type="text" id="lastname" name="lastname"><br /><br /> <input type="image" alt="Submit" width="40" height="40" src="/img/html/arrow.png"> </form> Try it liveIn this example the image name has a typo and cannot be loaded. The alt text displays next to an icon of a broken image. The submit button is still functional.
First name Last name <form action="/tutorial/action.html"> <label for="firstname">First name</label><br /> <input type="text" id="firstname" name="firstname"><br /> <label for="lastname">Last name</label><br /> <input type="text" id="lastname" name="lastname"><br /><br /> <input type="image" alt="Submit" width="40" height="40" src="/img/html/arrarow.png"> </form> Try it liveUsing alt
#
Alternative displays when the <input> image cannot be loaded.
Alternative text is also used by screen readers, search engines, etc.
Tip: Use the alt attribute on all your image inputs.
Syntax
#
<input src="URL" alt="text">Values
#
Value | Description |
---|---|
text | Alternative text for the image <input>. |
Browser support
#
Here is when src support started for each browser:
Chrome | 1.0 | Sep 2008 |
Firefox | 1.0 | Sep 2002 |
IE/Edge | 1.0 | Aug 1995 |
Opera | 1.0 | Jan 2006 |
Safari | 1.0 | Jan 2003 |
You may also like
#
- Our HTML input Tag Reference
- Our HTML Input Types Tutorial
- Our HTML alt Attribute Reference
- Our CSS Forms Tutorial
Từ khóa » Html Button Alt Text
-
HTML Input Alt Attribute - W3Schools
-
HTML Alt Attribute - W3Schools
-
Can The Alt Attribute Be Used For An Input Type Button - Stack Overflow
-
Image Buttons Must Have Alternate Text Axe Rules - Deque University
-
H36: Using Alt Attributes On Images Used As Submit Buttons - W3C
-
Image ALT Tag Tips For HTML - Accessibility At Penn State
-
Alt Text: Why It's Important For Accessibility & SEO - Moz
-
HTML Tag With The 'alt' Attribute
-
A Guide: The Right Way To Write Alt Text - Clique Studios
-
Alternative Text: Web Content - Accessibility - Indiana University
-
t - Web APIs | MDN
-
- HTML: HyperText Markup Language | MDN"> - HTML: HyperText Markup Language | MDN
-
Alternative Text - IT Accessibility - NC State University
-
HTML Img Alt Tags For SEO Best Practice - Search Engines Love ...