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

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML select size Eigenschaft

Die select size-Eigenschaft legt die Anzahl der sichtbaren Optionen in der Dropdown-Liste fest, wenn der Wert der size-Eigenschaft größer ist als1but 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-Beispiel

mit4eine Liste der sichtbaren Optionen

<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