Forms & Inputs
HTML <option> Tag
The <option> tag defines an option in a select list.
Definition and Usage
The <option> tag defines an option in a select list.
Standard Syntax:
<option>...</option>Interactive ExampleRunnable
HTML <option> Example
htmlLive code demonstration for the <option> tag. Click "Try it Yourself" to edit and experiment in real time.
<div style="font-family: system-ui, sans-serif; padding: 16px; background: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; color: #0f172a;">
<label for="cars">Choose a car:</label>
<select id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
</div>Attributes for <option>
3 Supported Attributes| Attribute | Values | Default | Description |
|---|---|---|---|
| disabled | disabled | none | Specifies that an option should be disabled |
| label | text | none | Specifies a shorter label for an option |
| selected | selected | none | Specifies that an option should be pre-selected when the page loads |
Global Attributes
The <option> tag also supports the standard global attributes in HTML, including class, id, style, title, hidden, and data-*.
Event Attributes
The <option> tag supports event attributes in HTML, such as onclick, onmouseover, onfocus, and more.
Browser Compatibility
ChromeEdgeFirefoxSafariOpera
More Tags in Forms & Inputs
View All 123Tags →<button>The <button> tag defines a clickable button.<datalist>The <datalist> tag specifies a list of pre-defined options for an <input> element.<fieldset>The <fieldset> tag is used to group related elements in a form.<form>The <form> tag is used to create an HTML form for user input.<input>The <input> tag specifies an input field where the user can enter data.<label>The <label> tag defines a label for several elements: