docs.rodeo

MDN Web Docs mirror

{{HTMLSidebar}} 

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.

{{EmbedInteractiveExample("pages/tabbed/option.html", "tabbed-standard")}} 

Attributes

This element includes the global attributes.

Styling with CSS

Styling the <option> element inside a <select> dropdown is highly limited and depends on the browser and operating system. Depending on the operating system, the font-size of the owning <select> is respected in Firefox and Chromium. Chromium may additionally allow color, background-color, font-family, font-variant, and text-align to be set.

You can find more details about styling <option> in our guide to advanced form styling.

Examples

See {{HTMLElement("select")}}  for examples.

Technical summary

Content categories None.
Permitted content Text, possibly with escaped characters (like &eacute;).
Tag omission The start tag is mandatory. The end tag is optional if this element is immediately followed by another <option> element or an `{{HTMLElement("optgroup")}}` , or if the parent element has no more content.
Permitted parents A `{{HTMLElement("select")}}` , an `{{HTMLElement("optgroup")}}`  or a `{{HTMLElement("datalist")}}`  element.
Implicit ARIA role option
Permitted ARIA roles No role permitted
DOM interface `{{domxref("HTMLOptionElement")}}` 

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN