HTML Select Tag
In HTML, the
<select> tag is used to create a drop-down list.
<select>tag is an inline element.
<option>tag is used inside the
<select>tag is used to define the options that should be available in the list.
<select> Tag Syntax and Usage
<select> tag requires the start(opening) tag and end(closing) tag. Given below is its basic syntax:
<select> ...content here </select>
<select> Tag Attributes
<select> tag supports both global and event attributes and some of the common attributes are given below:
This attribute is used to represent the number of rows that should be visible in a list one at a time. By default, the size attribute has value 0.
It is a boolean attribute that indicates that an option having a non-empty value must be selected.
This attribute is used to specify the name of the control.
The autofocus attribute is used to specify that a form control should focus on the input whenever the page loads; it is also a boolean attribute.
This attribute is used to specify the form to which this drop-down list belongs to.
This attribute is used to select multiple options at a time.
It is a boolean attribute; it is used to specify that the user cannot interact with a control.
HTML <select> Tag Basic Example
Below we have a basic example to show the usage of the <select> tag:
Default CSS Settings for HTML
Browser Support for HTML
Following browsers support this attribute:
Google Chrome 1+
Internet Explorer 2+
Apple Safari 1+