Example The size attribute displays two options in the drop-down list: <select size="2"> <option value=&q...
Example
The size attribute displays two options in the drop-down list:<select size="2"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> |
Definition and Usage
The size attribute specifies the number of visible options in a drop-down list.The size attribute is most often used together with the multiple attribute to define the number of options to be displayed.
If the value of the size attribute is greater than "1", but lower than the total number of options in the list, the browser will add a scroll bar to indicate that there are more options to view.
Browser Support
The size attribute is supported in all major browsers.Syntax
<select size="value"> |
Attribute Values
Value | Description |
---|---|
number | The number of visible options in the drop-down list |