The size Attribute

The Current State of HTML5 Forms

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

Live Demo

size=100

default

size=5

 


Firefox

Safari

Safari

Chrome

Opera

IE

Android

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.

Our Cookie Policy and Privacy Policy outline how we use cookies to help optimize service, personalize content, tailor and measure our marketing, and improve your user experience. I agree to use of cookies for these purposes.