Specifies the visible width, in characters, of the <input> element. The size attribute works with the following input types: text, search, tel, url, email, and password.

This only specifies the visible width of the input, not the length of data that can be entered. See the maxlength property to limit the length of entered data.

The size value is measured in numbers of characters. Each browser has slightly different techniques for determining how to convert this number into an actual number of pixels on screen. For more accurate control of the width of the <input>, use CSS to set the width.

Default value

Blank - the browser uses its own default size, usually around 20.

Valid values

Any integer value.