Table of Contents
Syntax of Dropdown List in HTML
How does the Dropdown List work in HTML?
Examples of  HTML Code
Example #3
結論
おすすめ記事
Home Web Front-end HTML Tutorial Dropdown List in HTML

Dropdown List in HTML

Sep 04, 2024 pm 04:38 PM
html html5 HTML Tutorial HTML Properties HTML tags

The dropdown list in HTML is an important element for form building purposes or for showing the selection list from which the user can select one or multiple values. This kind of selection list in HTML is known as the Dropdown list. It is created using is a tag used to create Dropdown list.

Setting background color or color to the hover by using code:

.dropdown a:hover{
Background-color: color_name;
}
Copy after login

Position for the dropdown list is defined into two values: position: a relative who is used to display the content of the list exactly right below the select list button. With the help of position: absolute;

Min-width is one of the properties used to give a specific width to the Drop Down list. We can set it as long as our drop-down button by setting the width to 100%. The above syntax is defined for single attribute selection; now, we will see how multiple options are going to be selected from the item list.

Syntax:

<select multiple>
<option value="">option1</option>
<option value="">option2</option>
</select>
Copy after login

Example:

<select name="subject" multiple>
<option value="math">Math</option>
<option value="english">English</option>
<option value="science">Science</option>
<option value="biology">Biology</option>
</select>
Copy after login

How does the Dropdown List work in HTML?

After studying the syntax now, we will see how exactly the Dropdown list is going to work in HTML. There are some attributes that are used in the