Select menus in HTML
A dropdown, with option groups and a multiple-selection variant.
<label for="lang">Language</label>
<select id="lang" name="lang">
<optgroup label="Systems">
<option value="c">C</option>
<option value="rust" selected>Rust</option>
</optgroup>
<optgroup label="Web">
<option value="html">HTML</option>
<option value="css">CSS</option>
</optgroup>
</select>
<select name="tags" multiple size="3">
<option>algorithms</option>
<option>strings</option>
</select>
How it works
optgrouplabels a block of related options.selectedpicks the initial option.multipleturns the menu into a list box.
The run, in numbers
- Lines
- 15
- Characters to type
- 392
- Tokens
- 119
- Three-star pace
- 70 tpm
At the three-star pace of 70 tokens a minute, this run takes about 102 seconds.
Step 3 of 6 in Choices, step 11 of 25 in Forms & inputs.