HTML autocapitalize Attribute
The HTML autocapitalize attribute is used to define whether the text present inside the HTML element should be automatically capitalized or not. It is a global attribute that means it is applied to all HTML elements.
Features:
- It specifies how the text will be automatically capitalized.
- It indicates that the first letter of the word or sentence would be in Capital.
- It does not support <input> tag with type URL, Email, and Password.
- It is a Global Attribute.
Syntax:
<tag_name autocapitalize="off | none | on | sentences | words | characters" />
Attribute Values:
- off/none: It defines that the text will not be capitalized.
- on/sentences: It defines that the first letter of each sentence would be capital.
- words: It defines that the first letter of each word would be capital.
- characters: It specifies that the whole text will be capitalized.
Example: Below HTML code use the auto-capitalize attribute with the <input> Tag.
HTML
<!DOCTYPE html> < html > < head > < title > HTML | autocapitalize Attribute < input > </ title > </ head > < body style = "text-align:center" > < h1 style = "color: green;" > w3wiki </ h1 > < h2 > HTML | autocapitalize Attribute with < input > Tag </ h2 > Name: < input type = "text" autocapitalize = "words" autofocus> < br >< br > <!-- Assign id to the Button. --> < button id = "GFG" > Submit </ button > < br > </ body > </ html > |
Output:
Important Note: This code is working on virtual keyboards such as on mobile devices and voice inputs. It is not working on physical keyboards.
Supported Browsers:
- Google Chrome 43.0 and above
- Edge 79 and above
Contact Us