HTML and CSS Reference
In-Depth Information
◗
3.
Save your changes to the file and then reopen
survey.htm
in your Web browser.
Verify that you can now select multiple items from the information source list using
the ctrl+click, command+click, or shift+click keyboard and mouse combinations.
Grouping Selection Options
In long selection lists, it can be difficult for users to locate a particular option value. You
can organize selection list options by placing them in option groups using the
optgroup
element
<select>
<optgroup label=”
label1
”>
<option>text1</option>
<option>text2</option>
...
</optgroup>
<optgroup label=”
label2
”>
<option>text1</option>
<option>text2</option>
...
</optgroup>
</select>
where
label1
,
label2
, and so forth are the labels for the different groups of options.
The text of the label appears in the selection list above each group of items but is not a
selectable item from the list. Figure 6-34 shows an example of a selection list in which
the options are divided into two groups.
figure 6-34
Organizing a selection list with option groups
HTML code
rendered selection list