<select> Tag in HTML | Drop-down List

The <select> tag in HTML is used to create a drop-down list. It allows users to choose one or more options from a list of predefined options. The options inside the select tag are defined using the <option> tag.

Key Points on <select> Tag:

Syntax of <select> Tag:

Syntax Example

<select name="car" id="car">
            <option value="volvo">Volvo</option>
            <option value="saab">Saab</option>
            <option value="fiat">Fiat</option>
            <option value="audi">Audi</option>
        </select>

Example of <select> Tag in HTML:

This example demonstrates how to create a drop-down list of car brands using the <select> tag.

Code Example

<!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>HTML Select Tag Example</title>
        </head>
        <body>
            <h1>Choose Your Favorite Car</h1>
            <form>
                <label for="car">Select a car brand:</label>
                <select name="car" id="car">
                    <option value="volvo">Volvo</option>
                    <option value="saab">Saab</option>
                    <option value="fiat">Fiat</option>
                    <option value="audi">Audi</option>
                </select>
                <input type="submit">
            </form>
        </body>
        </html>

Output

The <select> tag is an essential part of HTML forms, allowing users to choose from a list of options in a compact, accessible way. It supports both single and multiple selections, making it versatile for many use cases in web development.