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