HTML and CSS Reference
to the select element, where value is the number of options that the selection list
displays at one time. By specifying a size value greater than 1, you change the selec-
tion list from a drop-down list box to a list box with a scroll bar that allows users to
scroll through the selection options. If you set the size attribute equal to the number of
options in the selection list, the scroll bar either is not displayed or is dimmed, as shown
in Figure 6-30.
setting the size of the selection list
Alice has another selection list to add to the survey form, recording where the cus-
tomer heard of Red Ball Pizza. The survey presents the user with five options: the
Internet, a magazine, a newspaper, word of mouth, or other. Alice wants you to display
all of the options by setting the value of the size attribute to 5.
To set the selection list size:
1. Return to the survey.htm file in your text editor and add the following label and
selection list directly below the email field (see Figure 6-31):
<label>Where did you hear about us?</label>
<select name=”infoSrc” id=”infoSrc” size=”5”>
<option value=”word”>Word of Mouth</option>
creating the infosrc selection list
setting the size of the
selection list to five opti o ns
2. Save your changes to the file and then reopen survey.htm in your Web browser.
As shown in Figure 6-32, the selection list appears with all five options displayed.