Posts in current category

HTML5 <select> tag


May 03, 2021 19:00 HTML5


Table of contents


HTML5 is used to implement a pull-down list. Please refer to the following example:

Create a selection list with 4 options:

<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
Try it out . . .

Browser support

HTML5 <select> tag HTML5 <select> tag HTML5 <select> tag HTML5 <select> tag HTML5 <select> tag

All major browsers support the label.


Label definition and instructions for use

The element is used to create a pull-down list.

The label in the element defines the options available in the list.


Tips and comments

Tip: The element is a form control that can be used to accept user input in a form.


The difference between HTML 4.01 and HTML5

HTML5 adds some new properties.


Property

New: The new property in HTML5.

Property Value Describe
autofocus New autofocus Provides that the downlier list automatically gets focus when the page loads.
disabled disabled When the property is true, the pull-down list is disabled.
form New form_id Define one or more forms to which the select field belongs.
multiple multiple When the property is true, you can select more than one option.
name name Define the name of the pull-down list.
required New required Specifies that the user must select an option in the drop-down list before submitting the form.
size number Specify the number of options visible in the drop-down list.


Global properties

The label supports the global properties of HTML.


The event property

The tag supports the event properties of HTML.


Related articles

HTML DOM Reference Manual: Select Object

HTML Reference Manual: Ultra-detailed introduction to HTML and the use and techniques of tags