×

html · level 2 · unit 2 · lesson 3

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

<select> makes a of options.

When there are many choices, radio buttons fill the page. A drop-down list folds them away. Write <select>, with each choice in its own . The <select> gets the name, the id and the <label>.

Each option has a value, which the server receives, and words between its tags, which visitors see. They can differ: value="lon" can show London.

The first option shows until someone chooses. Add selected to a different option to start on that one instead.

<form>
  <label for="city">Nearest shop</label>
  <select id="city" name="city">
    <option value="lon">London</option>
    <option value="lds">Leeds</option>
    <option value="gla" selected>Glasgow</option>
  </select>
</form>

Press show my page to see it here.

Use radio buttons for two to four choices, so people see them all at once, and a drop-down for more.