Home > Web Front-end > HTML Tutorial > html: Usage of optgroup tag, grouped, read-only and displayed in tree style

html: Usage of optgroup tag, grouped, read-only and displayed in tree style

黄舟
Release: 2017-07-03 09:35:48
Original
1968 people have browsed it

Usage of optgroup tag in html, Group, read-only and displayed in tree style


in html In addition to the option tag in the select tag, there is another tag called optgroup. What can it do for us?

We have already understood the meaning of connecting points from the name: it is an option group, just like checkboxgroup and radiogurop, it is used for grouping ;    

Look at the following piece of code, open it in a browser and you can see a drop-down menu. But when you choose java or .Net, you can't choose.​​​

And the style is different from that of the option tag, and the font is bold. And the drop-down menu is displayed in a tree-like style.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  
<html>  
    <head>  
        <title>optgroup</title>  
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">  
        <meta http-equiv="description" content="this is my page">  
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">  
    </head>  
    <body>  
        <select>  
            <optgroup label="Java">  
                <option value="jsp Servlet">jsp Servlet</option>  
                <option value="javaEE">javaEE</option>  
            </optgroup>  
            <optgroup label=".Net">  
                <option value="aspx">aspx</option>  
                <option value="C#">C#</option>  
            </optgroup>  
        </select>  
    </body>  
</html>
Copy after login

The above is the detailed content of html: Usage of optgroup tag, grouped, read-only and displayed in tree style. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template