HTML <select> tag
The <select> tag is used to display a drop down list. The <select> tag only sets up a drop down list for usage, it does not create items within it. To create dropdown items, the <option> tag is used.
Attributes
| Attribute | Description | Possible values |
|---|---|---|
| disabled | Disables the drop down list (will be grayed out and inaccessible) | disabled |
| multiple | Specifies that more than one item at a time can be selected from the dropdown list | multiple |
| name | Sets the dropdown list's name | dropdownName |
| size | Sets how many items in the dropdown list can be seen at once (default is 1) | dropdownSize |
Standard attributes
class, dir, id, lang, style, tabindex, title, xml:lang
For more information on standard attributes, check out our HTML standard attributes reference page.
Event attributes
onblur, onchange, onclick, ondblclick, onfocus, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
For more information on event attributes, check out our HTML event attributes reference page.
Example
Tips & notes
Use the <label> tag to set the text of input elements in a form.
Use CSS to style form elements in many ways like setting a border, font size and color, background color, padding, and much more.
Use the <optgroup> tag to group together related elements in a dropdown list under one heading for better organization and usability.