English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <input> size attribute specifies the visible width of the <input> element (in characters), the size attribute is applicable to the following input types: text, search, tel, url, email, and password.
An HTML form that includes two input fields, with widths of11and6Number of characters:
<!DOCTYPE html> <html> <head> <title>HTML: <input> size attribute - Basic Tutorial Website(oldtoolbag.com)</title> <body> <form action="action_page.php"> Phone number: <input type="text" name="email" size="11><br> Postal code <input type="text" name="code" maxlength="6" size="6><br> <input type="submit" value="Submit"> </form> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the size attribute.
The size attribute specifies the visible width of the <input> element (in characters).
Note:The size attribute applies to the following input types: text, search, tel, url, email, and password.
Tip:To specify the maximum number of characters allowed in the <input> element, use maxlength properties.
None.
<input size="number">
Value | Description |
---|---|
number | Specifies the width of the <input> element in terms of character count. The default value is 20. |