The Current State of HTML5 Forms

The size Attribute

<input type="text" size=100>
<input type="text">
<input type="text" size=5>

Live Demo

size=100
default
size=5
Firefox
Safari
Safari Mobile
Chrome
Opera
IE
Android
Supported Supported Supported Supported Supported Supported Supported

The Low Down

The size attribute defines the width of the <input>form control.

  • Valid for <select> and input of type text, search, tel, url, email, and password. Otherwise it is ignored.
  • Defines the width of the <input>, unless overridden with CSS width property. The width will be the value of the size attribute in characters that the input will display.
  • Value should be an integer greater than zero.
  • When not defined, the width of most input elements defaults to 20.
  • In <select> it defines the number of options displayed.
  • The size attribute was also valid on <hr>, <font>, and <basefont>. It is now obsolete on <hr> (in favor of CSS), and both <font> and <basefont> have been deprecated.