🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

HTML <option> Tag

Create selectable items in dropdowns. Learn option structure and attributes.

option.html
<!-- Option -->
<select>
<option>Apple</option>
<option>Banana</option>
<option>Cherry</option>
</select>
option.html
1 / 7

Tutor:The <option> tag represents a selectable item in a dropdown menu. It must be inside a <select> or <optgroup> element. The text content of the option is what users see and can select.


Option Mastery

Unlock nodes by learning option and select structure.

Concept 1: The Option Tag

The <option> tag represents a selectable item in a dropdown menu. It must be inside a <select> or <optgroup> element. The text content of the option is what users see and can select.

System Check

Which element represents a selectable item in a dropdown?


Community Holo-Net

Share Option Designs

Created effective dropdowns? Share your code and option strategies.

Enjoying this guide?

Codesyllabus is 100% free and open-source. Support our mission, pay for server infrastructure, and fuel new tutorials by buying us a coffee!

HTML <option> Tag

Author

Pascual Vila

Frontend Instructor.

The <option> tag represents a selectable item in a dropdown menu. It must be inside a <select> or <optgroup> element. The text content of the option is what users see and can select.

Attributes

The <option> tag can have a value attribute that differs from the displayed text. This is useful when you want to send a different value to the server than what the user sees. The selected attribute marks an option as pre-selected. The disabled attribute makes an option non-selectable.

Common Use Cases

Common use cases include: dropdown menus for forms, country/state selectors, category filters, and any list where users need to choose one option. Options can be grouped with <optgroup> for better organization. Each option represents one choice in the dropdown.

Best Practices

Use <option> inside <select> or <optgroup> elements. Provide meaningful text content that users can understand. Use the value attribute when the submitted value should differ from the displayed text. Use selected for default selections. Consider grouping related options with <optgroup> for better UX.

Option Tag Glossary

<option>
HTML element that represents a selectable item in a dropdown menu. Must be inside <select> or <optgroup>. The text content is what users see and can select.
value Attribute
Optional attribute on <option> that specifies the value sent to the server when the form is submitted. Can differ from the displayed text. If omitted, the text content is used as the value.
selected Attribute
Boolean attribute on <option> that marks the option as pre-selected when the page loads. Only one option should be selected by default in a single-select dropdown.
disabled Attribute
Boolean attribute on <option> that makes the option non-selectable. Useful for placeholder options or temporarily unavailable choices. The option appears grayed out.
<select>
HTML element that creates a dropdown menu. Contains <option> or <optgroup> elements. The option must be inside a select element.