Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML input size attribute

HTML size property

HTML input Tag Reference HTML tag

Example

The two input fields in the following HTML form are 35 characters and 4 characters wide, respectively:

  Email:

  PIN:

 

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the size property.


Definition and Usage

The size attribute specifies the visible width of the element, measured in number of 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 element, use the maxlength attribute.


Differences between HTML 4.01 and HTML5

none.


Syntax

Attribute values

Value Description
number Specifies the width, in characters, of the element. Default value is 20.

HTML input Tag Reference HTML tag