Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How does the HTML drop-down box work?


May 29, 2021 Article blog



When we browse web pages, we often see the use of drop-down menus. F or example, in the selection of regions. S o how does html drop-down box work? This article tells you.

We need to create a new form form and then introduce the select tag in the form.

<body>
<form action="">
<select name="city">
<option value="fuzhou">福州</option>
<option value="xiamen">厦门市</option>
<option value="quanzhou">泉州</option>
<option value="zhangzhou">漳州</option>
</select>
</form>
</body>

The end result is as follows:

 How does the HTML drop-down box work?1

This is the simplest drop-down box usage. C omplicating matters is adding styles to make it more beautiful. F or example, in a common web front-end framework, there are various styles of frames that contain many drop-down box styles. Here's a drop-down box style in the front-end frame.

 How does the HTML drop-down box work?2

How to reference such a front-end framework is also mentioned in article: How to introduce CSS in HTML, which is no longer covered here.

That's all you need to know about how the HTML drop-down box works. For more forms to learn, go to HTML forms.