English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete List of HTML Tags

HTML select size attribute

the select size attribute specifies the number of visible options in the dropdown list, if the value of the size attribute is greater than1but less than the total number of options in the list, the browser will add a scrollbar to indicate that there are more options available to view.

 HTML <select> tag

Online Example

with4a dropdown list of visible options:

<form action="action_page.php">
<select name="lan" size="2">
  <option value="PHP">PHP</option>
  <option value="Python">Python</option>
  <option value="C#">C#</option>
  <option value="Golang">Golang</option>
</select>
<input type="submit">
</form>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

In Chrome and Safari, for size = “ 2“and size =” 3“”

Definition and Usage

The size attribute specifies the number of visible options in the drop-down list.

If the value of the size attribute is greater than1but less than the total number of options in the list, the browser will add a scrollbar to indicate that there are more options available to view.

HTML 4.01 with HTML5differences

None.

Syntax

<select size="number">

Attribute value

ValueDescription
number

The number of visible options in the drop-down list. The default value is1.
If the multiple attribute exists, the default value is4.

 HTML <select> tag