HTML <input> size Attribute

The size attribute on an <input> tag defines the character width of the element. Effectively, this is the number of characters that are visible.

Example

#

A size attribute on an <input> element.
The textbox is 25 characters wide, i.e. 25 characters are visible.


<label for="firstname">First name</label><br/>
<input type="text" size="25" 
       name="firstname" value="Melanie" >

Using size

The size attribute defines the <input> element's width in terms of number of characters.

This size attribute only applies to these input types:


Syntax

<input size="number">

Values

#

Value Description
number The number of visible characters in the input element.

Browser support

Here is when size support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <input>
Guides