How to define a drop-down list in HTML5 ?
In this article, we define a Drop-Down List By using the <select> Element in the Document. This tag is used to create a drop-down list. The <select> tag contains <option> tag to display the available option of drop-down list.
Note: The tag is used in a form to receive user response.
Syntax:
<select> <option> <option> ... <select>
Examples:
html
<!DOCTYPE html> < html > < head > < title > HTML5: How to define a drop-down list? </ title > </ head > < body style = "text-align:center;" > < h1 >GeeksforGeeks</ h1 > < h2 >HTML5: How to define a drop-down list? </ h2 > < p >Select one option from drop-down list:</ p > < select > < option value = "GFG" >GFG</ option > < option value = "OS" >OS</ option > < option value = "DBMS" >DBMS</ option > < option value = "Data Structure" > Data Structure </ option > </ select > </ body > </ html > |
Output :
Supported Browsers are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Please Login to comment...