Menu
Setting the Number of Items Visible in a Select List

An HTML Select list is a form control used to create a drop-down list of items from which the user can select. Each item in a select list is defined by an option element. The select list can appear as a drop-down list as shown below.

Or, by setting its size property it can appear as a scrolling list, displaying more than one item at a time. The select list below shows three items because its size attribute is set to 3.

<select size="3">
<option value="Bread">Bread</option>
<option value="Coffee">Coffee</option>
<option value="Pie">Pie</option>
<option value="Salad">Salad</option>
<option value="Soup">Soup</option>
</select>

If you set the size attribute to the number of items in the list, the list it will appear as an open list with no scrollbar, as shown below.

<select size="5">
<option value="Bread">Bread</option>
<option value="Coffee">Coffee</option>
<option value="Pie">Pie</option>
<option value="Salad">Salad</option>
<option value="Soup">Soup</option>
</select>

Note: When setting size to number of items in list, in Gecko-based browsers like Firefox and Chrome, the scrollbar is grayed out. In Internet Explorer the scrollbar is totally hidden.


Learn more at amazon.com

More HTML Code:
• How to Troubleshoot an HTML Table
• HTML abbr and acronym Tag
• HTML Horizontal Rule
• Code For a Basic 2-Column Fluid Webpage Layout
• HTML5 Nav Element
• HTML5 role Attribute
• HTML Text Tags Basics
• HTML Bulleted or Unordered List
• Image Map Basics
• Easy Code to Add Yahoo Site Search to Your Website