HTML input size property
Examples
The following HTML form width of the two input fields are 35 characters and 4 characters:
<form
action="demo_form.html">
Email: <input type="text" name="email" size="35"><br>
PIN: <input type="text" name="pin" maxlength="4" size="4"><br>
<input type="submit" value="提交">
</form>
Email: <input type="text" name="email" size="35"><br>
PIN: <input type="text" name="pin" maxlength="4" size="4"><br>
<input type="submit" value="提交">
</form>
try it"
Browser Support
All major browsers support the size attribute.
Definition and Usage
Visible width attribute specifies the size in terms of number of characters <input> elements.
Note: size attribute applies to the following input types: text, search, tel, url , email and password.
Tip: To specify the maximum number of characters <input> elements allow, use the maxlength attribute.
Differences between HTML 4.01 and HTML5
no.
grammar
<input size="number">
Property Value
值 | 描述 |
---|---|
number | 规定以字符数计的 <input> 元素的宽度。默认值是 20。 |
HTML <input> tag