HTML select size property
Examples
Visible with three options drop-down list:
<select size="3">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
try it"
Browser Support
All major browsers support the size attribute.
Definition and Usage
The number of drop-down list of options visible size attribute specifies.
If the value of the property size is greater than 1, but less than the total number of options in the list, the browser will display a scroll bar indicates that you can see more options.
Differences between HTML 4.01 and HTML5
no.
grammar
<select size="number">
Property Value
值 | 描述 |
---|---|
number | 下拉列表中可见选项的数目。默认值是 1。如果使用了 multiple 属性,默认值是 4。 |
HTML <select> tag