HTML size attribute

size attribute defines the visual size of input field (allows the number of characters to show) or the number of options shown to the user.

<p>which browser you mostly use?</p>	
 <select size="4">
  <option> Chrome
  <option> Firefox
  <option> Opera
  <option> IE
 </select>
</>

which browser you mostly use?

In the above example a user can see 4 options instead of one. The value indicates the number of options to show.

Attribute values

All possible values of size attribute

The value of this attribute is a valid positive integer.

Related Tags

The tags that support size attribute

<input> tag

This element allows the user to enter data in the form. It takes part in making the structure of a form to collect the data.

<input type="text" size="40">
Try</>

The default size of input control is 20. In the above example, the browser allows the user to see 40 characters.

<select> tag

This element represents different options in the form of drop down list. One option is selected from this list of options.



Was this article helpful?

 

Email:

Message: