Advertisement
Home Open Editor ❯

HTML <input> size Attribute

Example

<form action="action.php">
  <label for="uname">User name:</label>
  <input type="text" id="uname" name="uname" size="10">

  <label for="pin">PIN:</label>
  <input type="password" id="pin" name="pin" maxlength="4" size="4">

  <input type="submit" value="Submit">
</form>

Try this code ❯

Meaning

The size attribute specifies the visible dimension, in characters, of a text form control.

This differs from the maximum length of content, which can be entered in a form control set by the maxlength attribute.


Standard Syntax

HTML: <input size="number">

XHTML: <input size="number"/>


Advertisement

Attribute Values

Value Description
number Specifies the size of the input field. (Default value is 20.)
Home Open Editor ❯
Advertisement