Heim > Web-Frontend > HTML-Tutorial > Dropdown-Liste in HTML

Dropdown-Liste in HTML

王林
Freigeben: 2024-09-04 16:38:38
Original
632 Leute haben es durchsucht

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;
}
Nach dem Login kopieren

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>
Nach dem Login kopieren

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>
Nach dem Login kopieren

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