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.

Example

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

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

size attribute values

The value of this attribute is a valid positive integer.

Related Tags

The tags that support this attribute are as follows.

<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.

Example

<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.

See the example given above.

Related Pages

option element defines an option.

visit select for more information.



Was this article helpful?

 

Email:

Message:

Get the newsletter