HTML <select> Tag with the 'size' Attribute
<form id="myForm" action="/resources/html-forms-action.cfm">
<select name="Food" size="4">
<option value ="apples">Apples</option>
<option value ="bananas">Bananas</option>
<option value ="oranges">Oranges</option>
<option value ="cabbage">Cabbage</option>
<option value ="carrots">Carrots</option>
<option value ="potatoes">Potatoes</option>
<option value ="beef">Beef</option>
<option value ="chicken">Chicken</option>
<option value ="pork">Pork</option>
</select>
<button>Submit</button>
</form>
The above example demonstrates usage of the <select>
element with the size
attribute.
The size
attribute allows you to specify a size for the <select>
list. Specifically, it allows you to specify how many options to display (without the user having to interact with the control).
You can also use the multiple
attribute to allow the user to select multiple options.