Introduction to the use of select optgroup tag in html

Introduction to the use of select optgroup tag in html
Occasionally, I need to group select contents. In the past, I used program control. Today, I found that there is an optgroup attribute in select that can be used.

It has been tested and is suitable for browsers such as Firefox and IE. The only shortcoming found so far is that the title style after the group cannot be customized. For example: if you want to change the font properties, you can't use the normal font, but you can change the color and size. In IE, the default is italic and bold


Copy code
The code is as follows:

<select name="bid" id="brand_3">
<option value="">Please select a brand</option>
<optgroup label="A"></optgroup>
<option value="693" custom="693">A AC BMW</option>
<option value="62" custom="62">A Aston Martin</option>
<option value="1" custom="1">A Audi</option>
<optgroup label="B"></optgroup>
<option value="723" custom="723">B Babos</option>
<option value="44" custom="44">B Porsche</option>
<option value="582" custom="582">B Baojun</option>
<option value="20" custom="20">B BMW</option>
<option value="593" custom="593">B Beijing Auto</option>
<option value="643" custom="643">B BAIC Weiwang</option>
<option value="122" custom="122">B BAIC Manufacturing</option>
<option value="4" custom="4">B Mercedes-Benz</option>
</select>

<<:  Vue+openlayer5 method to get the coordinates of the current mouse slide

>>:  CSS achieves the effect of changing the color of the entire line when the mouse is placed on it

Recommend

Ubuntu installs multiple versions of CUDA and switches at any time

I will not introduce what CUDA is, but will direc...

Learn MySQL database in one hour (Zhang Guo)

Table of contents 1. Database Overview 1.1 Develo...

Web page creation basic declaration document type description (DTD

Using CSS layout to create web pages that comply w...

Detailed explanation of desktop application using Vue3 and Electron

Table of contents Vue CLI builds a Vue project Vu...

25 div+css programming tips and tricks

1. The ul tag has a padding value by default in M...

Nginx reverse proxy to go-fastdfs case explanation

background go-fastdfs is a distributed file syste...

Mysql varchar type sum example operation

Some friends, when learning about databases, acci...

Example of automatic stop effect after text scrolling

The effect is very simple, just copy the following...

mysql solves time zone related problems

Preface: When using MySQL, you may encounter time...

Detailed explanation of MySQL group sorting to find the top N

MySQL group sorting to find the top N Table Struc...

How to create a my.ini file in the MySQL 5.7.19 installation directory

In the previous article, I introduced the detaile...