HTML - 'Drop down' lists and selection forms

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 name so fancy.

<select>

<option>New York </option>

<option>Bucharest</option>

<option>Madrid</option>

</select>

 

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

<select>

<option>New York </option>

<option selected="yes">Bucharest</option>

<option>Madrid</option>

</select>


HTML - Selection forms

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

<select size="3">

<option>New York </option>

<option>Bucharest</option>

<option>Madrid</option>

</select>


HTML - Multiple selections

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

<select multiple="yes" size="3">

<option>New York </option>

<option>Bucharest</option>

<option>Madrid</option>

</select>

 

It is to be understood that this attribute will not work with a drop down list.