HTML Drop Down Menu

HTML Tutorial > HTML Form > Drop Down Menu

Drop down menu is another common way to specify input data. For example, selecting a state is often done via a drop down menu. Users can select one or more items in a drop-down menu. Below is an example for a single-selection drop down menu:

<select name=color>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>

In this case, the key is color, and the values can be either red, green, or blue, depending on the item selected.

If we want to pre-select a check box, we'll specify "selected" at the end of the <input> tag, such as follows:

<input type="checkbox" name="color" value="red" selected>Red<br>

If we want to select multiple items, we specify "multiple" at the end of the <select> tag, i.e.,

<select name=color multiple>

Next: HTML Color Codes

Copyright © 2022   All Rights Reserved     Privacy Policy   About   Contact