Content · Web Development · HTML

HTML <select> and <option>: Dropdown Selection

Select shows a menu of options, while each option has a readable label and, often, a value that is sent with the form.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Select shows a menu of options, while each option has a readable label and, often, a value that is sent with the form. We will keep the example small, so you can see how the fields work without building a whole application first.

What You Need to Know


Use a visible label and clear option wording. The value attribute can differ from the text people see; if omitted, the text usually becomes the submitted value.

Example: See It in Action


Take a look at this small piece of HTML. You can use it in a practice document and change the text to make it your own.

This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.

<form action="/preferences" method="post">
    <label for="theme">Choose a theme</label>
    <select id="theme" name="theme">
        <option value="light">Light</option>
        <option value="dark">Dark</option>
    </select>
    <button type="submit">Save</button>
</form>

Let’s Understand the Example


  • Select offers a set of options; choose multiple only when several values may be selected.
  • Option represents one possible choice within select or datalist.
  • Action names the destination where the browser sends a form submission. A real server handler must exist there.
  • Method controls how a form submits; GET makes values part of the URL, while POST sends them in the request body.
  • For links a label to the input whose id matches, so clicking the label can focus the control.
  • Id gives one element a unique name within the page, so a link, label, or script can point to it.

The browser can submit values with keys such as theme. A control without a name normally contributes no entry. Whether the submission produces a result depends on the action URL and the server behind it.

What Should You See?


You should see controls for Choose a theme. The example uses an input of type text and sends a POST request when submitted. If the action points to a missing server endpoint, the browser cannot complete the task.

Choose one field and predict its submitted name and value. Then change the value and check whether the browser accepts it. Do not assume that a working-looking form has a real server behind it.

Try It Yourself


  1. Add a third theme option and predict which value would be submitted.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Leaving the select without a name and losing the selected value on submission.
  • Client-side HTML validation is a helpful first check, not a security boundary. A real receiving application must validate the values again.

Key Takeaways


  • Select shows a menu of options, while each option has a readable label and, often, a value that is sent with the form.
  • Select offers a set of options; choose multiple only when several values may be selected.
  • Use a visible label and clear option wording. The value attribute can differ from the text people see; if omitted, the text usually becomes the submitted value.
Share this resourceSend this page to someone who may find it useful.