HTML and CSS Reference
The select element is a container element, allowing any number of option and op-
tgroup elements. It normally displays as a drop-down list, as shown in Figure 4-20 .
Figure 4-20. A select menu
This element has two specific attributes not covered elsewhere, disabled and
size . 6 It also may use the multiple attribute (first brought up earlier in this chapter
in the file input section). The Boolean disabled attribute can be added to disable
(gray out) user interaction with the menu. The size and multiple attributes are re-
lated. If the Boolean multiple attribute is added, the select menu will normally
display as a scrollable list box that permits multiple selections by the user, by holding
down the Command key (Mac) or Control key (Windows) and clicking multiple items.
The size attribute, which accepts a numerical value, determines how many rows of
options are displayed. Figure 4-21 shows an example of a list menu.
6 It also has the global attributes covered in Chapter 2 and the name , required , autofocus ,
and form attributes covered earlier in this chapter.
Figure 4-21. A list menu, created with a select element with a multiple attribute added
Each row within a select is contained within an option element, like so: