forms
<select>
Drop-down (or list-box) that lets the user pick one or more predefined options. Use it when the option set is short and known; for many options, an autocomplete input is friendlier.
<select name="country"><option value="us">United States</option></select> Common attributes
| Attribute | Purpose |
|---|---|
| name | Key submitted with the form |
| multiple | Allow selecting more than one option |
| size | Number of rows shown at once |
| required | Must have a non-empty value to submit |
| disabled | Blocks interaction |
| autocomplete | Autofill hint (country, sex, etc.) |
Examples
<select name="country"><option value="us">US</option><option value="in">India</option></select> Basic single-select
<select name="skills" multiple size="4"><option>HTML</option><option>CSS</option></select> Multi-select list box
<select name="plan" required><option value="">Choose…</option><option value="pro">Pro</option></select> Required select with an empty placeholder option
Gotcha
For required to actually block submission, the placeholder option's value must be empty (value=""). Native
Related tags
<input>
The single most versatile form control — its behavior is driven by the type attribute (text, email, password, number, checkbox, radio, file, date, range, color, hidden, and more). Use it for every scalar user input; use <textarea> only for multi-line text.
<form>
Container for a set of input controls that are submitted together to a server. Use it any time users need to send data — search, sign-up, checkout, comments.
<label>
Associates a caption with a form control so clicking the label focuses the input and screen readers announce it. Use one for every input, select, and textarea.
<button>
Interactive control that triggers an action — submitting a form, opening a dialog, or running JavaScript. Use it for anything that does something; use <a href> for anything that navigates.
<textarea>
Multi-line plain-text input control. Use it for comments, messages, code snippets, or any free-form text that may span more than one line.