Create a drop-down list with four options.
The <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> tags inside the <select>
element define the available options in the drop-down list.
Tip: Always add the <label> tag for best accessibility practices!
Example:
HTML
<label for="cars">Choose a car:</label>
<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>
Type: | Html |
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded by: | Admin |