HTML select

Last Updated:

HTML select

The HTML <select> tag allows the user to choose one value from a list.

Note: The <option> tag is used to define an item contained in the <select> tag, <optgroup> tag, or <datalist> tag.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <select> <option>Morning</option> <option>Afternoon</option> <option>Night</option> </select> </body> </html>

HTML Select with Option Group

Use <optgroup> tag to create a group of options within a <select> element.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <select> <optgroup label="Asian Countries"> <option>India</option> <option>China</option> <option>Japan</option> </optgroup> <optgroup label="European Countries"> <option>Germany</option> <option>Italy</option> <option>France</option> </optgroup> </select> </body> </html>

Share this Page

Meet the Author