files/en-us/web/html/reference/elements/option/index.md
The <option> HTML element is used to define an item contained in a {{HTMLElement("select")}}, an {{HTMLElement("optgroup")}}, or a {{HTMLElement("datalist")}} element. As such, <option> can represent menu items in popups and other lists of items in an HTML document.
{{InteractiveExample("HTML Demo: <option>", "tabbed-standard")}}
<label for="pet-select">Choose a pet:</label>
<select id="pet-select">
<option value="">--Please choose an option--</option>
<option value="dog">Dog</option>
<option value="cat">Cat</option>
<option value="hamster">Hamster</option>
<option value="parrot">Parrot</option>
<option value="spider">Spider</option>
<option value="goldfish">Goldfish</option>
</select>
label {
font-family: sans-serif;
font-size: 1rem;
padding-right: 10px;
}
select {
font-size: 0.9rem;
padding: 2px 5px;
}
This element includes the global attributes.
disabled
label
label attribute isn't defined, its value is that of the element text content.selected
<option> element is the descendant of a {{HTMLElement("select")}} element whose multiple attribute is not set, only one single <option> of this {{HTMLElement("select")}} element may have the selected attribute.value
Styling <option> elements has historically been highly limited. Customizable select elements explains newer features that enable their full customization, just like any regular DOM element.
In browsers that don't support the modern customization features (or legacy codebases where they can't be used), the styling available on <option> elements depends on the browser and operating system. Depending on the operating system, the {{cssxref("font-size")}} of the owning <select> is respected in Firefox and Chromium. Chromium may additionally allow {{cssxref("color")}}, {{cssxref("background-color")}}, {{cssxref("font-family")}}, {{cssxref("font-variant")}}, and {{cssxref("text-align")}} to be set.
You can find more details about legacy <option> styling in our guide to advanced form styling.
See {{HTMLElement("select")}} for examples.
{{Specifications}}
{{Compat}}