HTML5 Select

The select> element creates a dropdown list of options that can be selected. It is most often used inside a form to collect user input.

It is important to include a label> tag with every select to help assistive technologies identify the control. The name attribute is also needed so that the selection data can be retrieved after submission.


The select> tag constructs a drop-down menu of options. It accepts most form input attributes and also has eight tag-specific ones, including multiple to allow more than one option to be selected, and size to determine how many lines of options will display at a time.

The value attribute defines the data value that should be submitted to the server if any of the select options are chosen. If no value attribute is included, it defaults to the text content of the option element.

optgroup> elements can be placed within a select> tag to group options into distinct categories. For example, a group named “Hamster” might include options such as “Sexy” and “Real”. Each group may have its own label and unique option. Other tags that can be placed inside a select are required, disabled, autofocus, and name. All of these tags can be used to create different interactive states for a select, such as enabled, hover, selected, focus, error, warning, skeleton, and disabled.


Identifies one or more CSS classes to be applied to the select element. Defines additional data that can be used by JavaScript.

Specifies the number of options that are visible in the drop down list. If this attribute is not present, most browsers will display a single line dropdown.

Indicates that the select item must be selected by the user before submitting the form. Support for this attribute varies between browsers, so authors may need to use scripts to ensure that this is always true.

Specifies the name of the select element. This is a required attribute unless it is overridden by an ancestor form> element. Specifies the tab sequence for the select element, when it is surrounded by form> elements. The default is 2.


The select element supports a number of behaviors, including the ability to create a list of options, which can be displayed as a dropdown. It also supports a number of global attributes, such as disabled and multiple, as well as the required attribute, which is used to require a user response before form submission.

In addition to its standard interactive states, select can be rendered as a skeleton for accessibility purposes with the skeleton attribute. This state removes all interactive functions but is focusable, accessible by screen readers, and passes visual contrast checks.

The tabindex attribute determines the order in which select tags receive keyboard focus. This can be useful in constructing more complex forms, or when you need to ensure that all selections are available for users with disabilities.


The select element allows the user to choose from a list of options. This is useful when creating forms that need to collect data from the users. For example, a form may need to collect feedback from customers about a coffee shop.

The select> tag works in conjunction with the optgroup> element to produce the list of options for the user to choose from. The select element can be styled using the select>-style> attribute, which specifies how the element should appear to the user.

The select>-style> tag can be used inline or embedded within the head tag of an HTML document. However, it’s best to use external CSS so that you can separate your stylesheet from the HTML. In addition, CSS styles are more stable than attributes. Attributes can change in future versions of browsers and could break your website. This is especially important when working with deprecated code, like the font tag. CSS is also more flexible than the font tag, because you can apply multiple classes to a single element.

Scuttle back to the home screen