select – drop-down list
<select name="name"><option>…</option></select>
A choice from a menu: a drop-down list (the default), with the multiple or size attribute a list with more visible rows. The options are option elements, optionally grouped in optgroup. Without other attributes the first option is selected.
- Default display:
display: inline-block - End tag: required
- Content:
option,optgroupandhrseparators - Where it can be used: anywhere phrasing content is allowed
- DOM interface:
HTMLSelectElement
Attributes
- name – the name of the value when submitted.
- multiple – more options can be selected (with the Ctrl or Shift key).
- size – how many rows are visible at once.
- required – an option with a non-empty value must be selected.
- disabled, autocomplete, form.
Examples
A required choice with an opening prompt – an option with an empty value does not pass with required:
<label for="v-branch">Branch</label> <select id="v-branch" name="branch" required> <option value="">Choose a branch…</option> <option value="springfield">Springfield</option> <option value="chicago">Chicago</option> </select>
Selecting several options:
<label for="v-allergens">Free from</label><br> <select id="v-allergens" name="allergens[]" multiple size="3"> <option value="gluten">gluten</option> <option value="milk">milk</option> <option value="eggs">eggs</option> </select>
Accessibility
select needs a label like every field. Selecting several options with multiple is confusing for many people (they do not know about the Ctrl key) – checkboxes are easier to understand.
Things to watch out for
- The look of the open list is determined by the browser and the operating system and CSS barely affects it. A fully stylable select via
appearance: base-selectis so far supported by only some browsers (as of October 2026). - With
multiple, writename="allergens[]"in PHP – otherwise the server gets only the last selected value. - For two or three options, radio buttons (
input type="radio") are clearer; for dozens of options aninputwith adatalist.
Browser support
Baseline – widely available: works in all major browsers and has for a long time (since 2015 at the latest). Since version: Chrome 1, Firefox 1, Safari 1. As of October 2026 (MDN browser-compat-data).
Related:
option – list option
optgroup – option group
datalist – suggested values
input – input field
label – field label
hr – thematic break