HTML - Select menu

  »   HTML  »   HTML Tutorial - drop down lists menu

The drop-down lists are one of the most practical types of lists. You probably already came across them all over the internet, but without knowing they had a fancy name like this.

html<select name="my_html_select_box">

	<option>New York </option>
	<option>Bucharest</option>
	<option>Madrid</option>

</select>

Demo

The browser will automatically show the first option. This thing can be changed with the help of the 'selected' attribute though.

html<select name="my_html_select_box">

	<option>New York </option>
	<option selected="yes">Bucharest</option>
	<option>Madrid</option>

</select>

Demo

HTML - Selection forms

We will use the size attribute to change a drop-down list to a selection form

html<select name="my_html_select_box" size="3">

	<option>New York </option>
	<option>Bucharest</option>
	<option>Madrid</option>

</select>

Demo

HTML - Multiple selections

In the case in which the user wants to choose more than one of the options, we will make it easier with the help of the multiple attribute.

html<select name="my_html_select_box" multiple="yes" size="3">

	<option>New York </option>
	<option>Bucharest</option>
	<option>Madrid</option>

</select>

Demo

It is to be understood that this attribute will not work with a drop down list, and only whet the size attribute it is set.