Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
The <select> HTML element represents a control that provides a menu of options.
The above example shows typical <select> usage. It is given an id attribute to enable it to be associated with a <label> for accessibility purposes, as well as a name attribute to represent the name of the associated data point submitted to the server. Each menu option is defined by an <option> element nested inside the <select>.
Each <option> element should have a value attribute containing the data value to submit to the server when that option is selected. If no value attribute is included, the value defaults to the text contained inside the element. You can include a selected attribute on an <option> element to make it selected by default when the page first loads. If no selected attribute is specified, the first <option> element will be selected by default.
A <select> element is represented in JavaScript by an HTMLSelectElement object, and this object has a value property which contains the value of the selected <option>.
The <select> element has some unique attributes you can use to control it, such as multiple to specify whether multiple options can be selected, and size to specify how many options should be shown at once. It also accepts most of the general form input attributes such as required, disabled, autofocus, etc.
You can further nest <option> elements inside <optgroup> elements to create separate groups of options inside the dropdown. You can also include <hr> elements to create separators that add visual breaks between options.
For further examples, see The native form widgets: Drop-down content.
This element includes the global attributes.
autocompleteA string providing a hint for a user agent's autocomplete feature. See The HTML autocomplete attribute for a complete list of values and details on how to use autocomplete.
autofocusThis Boolean attribute lets you specify that a form control should have input focus when the page loads. Only one form element in a document can have the autofocus attribute.
disabledThis Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example <fieldset>; if there is no containing element with the disabled attribute set, then the control is enabled.
formThe <form> element to associate the <select> with (its form owner). The value of this attribute must be the id of a <form> in the same document. (If this attribute is not set, the <select> is associated with its ancestor <form> element, if any.)
This attribute lets you associate <select> elements to <form>s anywhere in the document, not just inside a <form>. It can also override an ancestor <form> element.
multipleThis Boolean attribute indicates that multiple options can be selected in the list. If it is not specified, then only one option can be selected at a time. When multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown. Multiple selected options are submitted using the URLSearchParams array convention, i.e., name=value1&name=value2.
nameThis attribute is used to specify the name of the control.
requiredA Boolean attribute indicating that an option with a non-empty string value must be selected.
sizeIf the control is presented as a scrolling list box (e.g., when multiple is specified), this attribute represents the number of rows in the list that should be visible at one time. Browsers are not required to present a select element as a scrolled list box. The default value is 0.
Note: According to the HTML specification, the default value for size should be 1; however, in practice, this has been found to break some websites, and no other browser currently does that, so Mozilla has opted to continue to return 0 for the time being with Firefox.
On a desktop computer, there are a number of ways to select multiple options in a <select> element with a multiple attribute:
Mouse users can hold the Ctrl, Command, or Shift keys (depending on what makes sense for your operating system) and then click multiple options to select/deselect them.
Warning: The mechanism for selecting multiple non-contiguous items via the keyboard described below currently only seems to work in Firefox.
On macOS, the Ctrl + Up and Ctrl + Down shortcuts conflict with the OS default shortcuts for Mission Control and Application windows, so you'll have to turn these off before it will work.
Keyboard users can select multiple contiguous items by:
Keyboard users can select multiple non-contiguous items by:
The <select> element has historically been difficult to style effectively with CSS. The following guides contain information about features that enable fully customizable select elements:
In browsers that don't support the modern customization features (or legacy codebases where they can't be used), you are limited to manipulating the box model, the displayed font, etc. You can also use the appearance property to remove the default system appearance.
It is however, hard to get a consistent result across browsers with traditional <select> elements. If you want to get full control, you should consider using a library with good facilities for styling form widgets, or try rolling your own dropdown menu using non-semantic elements, JavaScript, and WAI-ARIA to provide semantics.
You can use the :open pseudo-class to style <select> elements in the open state, that is, when the drop-down options list is displayed. This doesn't apply to multi-line <select> elements (those with the multiple attribute set) — they tend to render as a scrolling list box rather than a drop-down, so don't have an open state.
For more information on legacy <select> styling, see:
The <hr> within a <select> should be considered purely decorative, as they are currently not exposed within the accessibility tree and therefore not exposed to assistive technologies.
The following example creates a three-value dropdown menu. The second option includes the selected attribute, making that option selected by default.
The following example creates a dropdown menu with grouping using <optgroup> and <hr> to make it easier for the user to understand the content in the dropdown.
The following example is more complex, showing off more features you can use on a <select> element:
| Flow content, phrasing content, interactive content, listed, labelable, resettable, and submittable form-associated element |
|
| None, both the starting and ending tag are mandatory. |
| Any element that accepts phrasing content. |
| combobox with no multiple attribute and no size attribute greater than 1, otherwise listbox. |
| menu with no multiple attribute and no size attribute greater than 1, otherwise combobox is permitted but not recommended. |
| HTMLSelectElement |
| HTML # the-select-element |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Apr 24, 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.