html5 implements drop-down list tags such as "
![What are the tags used to implement drop-down lists in html5](https://img.php.cn/upload/article/202112/15/2021121518192763947.jpg)
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
In HTML5, if you want to implement a drop-down list, you need to use
and
together. Syntax:
Copy after login
Among them, the
tag is used to create a drop-down list, and the
tag represents each item (entry) in the drop-down list.
Example:
喜欢的水果:
Copy after login
![1639563409362587.gif What are the tags used to implement drop-down lists in html5](https://img.php.cn/upload/image/385/254/157/1639563409362587.gif)
It can be seen that the drop-down list will display the first item first by default, so what if a certain item is pre-selected?You can use theselected
attribute of the tag.
After setting the selected attribute for the
喜欢的水果:
Copy after login
![1639563548858165.png What are the tags used to implement drop-down lists in html5](https://img.php.cn/upload/image/114/819/457/1639563548858165.png)
Recommended tutorial: "html video tutorial"
The above is the detailed content of What are the tags used to implement drop-down lists in html5. For more information, please follow other related articles on the PHP Chinese website!