30/09/2014

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.
Input
<select>
<option>Pakistan
</option> <option>Dubai
</option>
<option>Arab
</option>
</select>

Output

The browser will automatically show the first option. This thing can be changed with the help of the selected attribute though <select>
Input
<select>
<option>Arab
</option>
<optionselected="yes">Dubai</option>
<option>Pakistan</option>
</select>

Output

HTML Selection forms
We will use the size attribute to change a drop down list to a selection form
Input
<selectsize="3">
<option>Arab
</option>
<option>Dubai</option>
<option>Pakistan</option>
</select>

Output

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.
Input
<selectmultiple="yes"size="3">
<option>Arab
</option>
<option>Dubai</option>
<option>Pakistan</option>
</select>

Output

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