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

CSS to achieve Tik Tok subscription button animation effect

I was watching Tik Tok some time ago and thought ...

Detailed explanation of simple html and css usage

I will use three days to complete the static page...

Teach you how to quickly enable self-monitoring of Apache SkyWalking

1. Enable Prometheus telemetry data By default, t...

Vue globally introduces scss (mixin)

Table of contents 1. mixin.scss 2. Single file us...

Example of using Docker Swarm to build a distributed crawler cluster

During the crawler development process, you must ...

MySQL 8.0.22 installation and configuration method graphic tutorial

This article records the installation and configu...

Teach you MySQL query optimization analysis tutorial step by step

Preface MySQL is a relational database with stron...

How to use gdb to debug core files in Linux

1.core file When a Segmentation fault (core dumpe...

Implementation of multi-site configuration of Nginx on Mac M1

Note: nginx installed via brew Website root direc...

What does the n after int(n) in MySQL mean?

You may already know that the length 1 of int(1) ...

Implementation of services in docker accessing host services

Table of contents 1. Scenario 2. Solution 3. Conc...

MySQL table name case selection

Table of contents 1. Parameters that determine ca...

MySQL constraint types and examples

constraint Constraints ensure data integrity and ...