HTML select tag | HTML dropdown
ExampleCreateadrop-downlistwithfouroptions:Chooseacar:
Create a drop-down list with four options:
Choose a car:<select name="cars" id="cars"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option></select>
Try it Yourself »[1]More "Try it Yourself" examples below.
Definition and UsageThe <select> element is used to create a drop-down list.
The <select> element is most often used in a form, to collect user input.
The name attribute is needed to reference the form data after the form is submitted (if you omit the name attribute, no data from the drop-down list will be submitted).
The id attribute is needed to associate the drop-down list with a label.
The <option>[2] tags inside the <select> element define the available options in the drop-down list.