title drop-down list html

title drop-down list html

Introduction to Dropdown List in HTML

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




Example:

As shown in the above syntax , 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;
}

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.

Popular Course in this category
title drop-down list html
HTML Training (12 Courses, 19+ Projects, 4 Quizzes)12 Online Courses | 19 Hands-on Projects | 89+ Hours | Verifiable Certificate of Completion | Lifetime Access | | 4 Quizzes with Solutions
4.5 (7,973 ratings)
Course Price

View Course

Related Courses
Bootstrap Training (2 Courses, 6+ Projects)XML Training (5 Courses, 6+ Projects)CSS Training (9 Courses, 9+ Projects)

Syntax:

Example:

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









The above example contains different options like disabled, selected, required, etc., which is shown in the output screen.

Output:

title drop-down list html

Example #2

Code:




Multiple options can be selected here .Please press ctrl key and select multiple options at a time.




As shown in the below screenshot, select multiple options from the dropdown list, press the given button and select multiple options by pressing on CTRL.

Output:

title drop-down list html

Example #3

Code:







Hover Dropdown Demo




The dropdown list will be open on the hover effect.

Output:

title drop-down list html

Conclusion

We can conclude that the Dropdown list is used to select an option from the selection list. It is used to select single or multiple options at a time. Users can select an option from the list as per their choice, so it becomes more user-friendly. Attributes listed above is used with the select tags to do various selection operations with the Dropdown list.

Recommended Article

This is a guide to Dropdown List in HTML. Here we discuss how Dropdown List Work in HTML and its Examples with Code Implementation. You can alsogo through our other related articles to learn more

  1. HTML Style Attribute
  2. Top 10 Advantages of HTML
  3. HTML Frames
  4. HTML Layout

HTML Training (12 Courses, 19+ Projects, 4 Quizzes)

12 Online Courses

19 Hands-on Projects

89+ Hours

Verifiable Certificate of Completion

Lifetime Access

4 Quizzes with Solutions

Learn More

1 Shares
Share
Tweet
Share