HTML <select> sizeAttribute

HTML select 标签参考手册HTML <select> Tag

Examples

A drop-down list with three visible options:

<select size="3">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the size attribute.


Definition and Usage

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

If the value of the size attribute is greater than 1, but less than the total number of options in the list, the browser will display a scroll bar, indicating that more options can be viewed.


Differences Between HTML 4.01 and HTML5

None.


Syntax

<select size="number">

Attribute Values

Value Description
number The number of visible options in the drop-down list. The default value is 1. If the multiple attribute is used, the default value is 4.


HTML select 标签参考手册HTML <select> Tag Other Extensions