HTML and CSS Reference
In-Depth Information
By default, the select list form control acts like a radio button in that it allows one mutually exclu-
sive choice from many. To change the behavior to be like checkboxes, you add the multiple attri-
bute to the <select> tag, like this:
<select name=”region” id=”region” multiple=”multiple” size=”5”>
When you add the multiple attribute, the select list transforms from a drop-down list to a fully
visible menu of selections as shown in Figure 19-7. To make multiple selections, the user must press
Ctrl on the PC, Command on the Mac, or — for contiguous selections — Shift on either platform.
FiGure 19-7
The size attribute determines how large the visible menu should be. If you choose less than the
number of entries, a scroll bar appears so the user can select their option(s) from the entire list.
Try iT
In this Try It you learn how to add a select list to an online form.
Lesson requirements
You will need the tpa_saturn.html file from the previous exercise, as well as a text editor and web
browser.
step-by-step
1.
Open your text editor.
2.
From the Lesson_19 folder, open the previously saved tpa_saturn.html .
3.
Put your cursor at the end of the opening </p> tag after the closing </textarea> tag and
press Enter (Return).
4.
Enter the following code:
<p>
<label for=”age”>Age</label>
<select name=”age” id=”age”>
<option value=”Under_12”>Under 12 not allowed</option>
<option value=”12_18” selected>12 - 18</option>
Search WWH ::




Custom Search