Home >Web Front-end >HTML Tutorial >html: Usage of optgroup tag, grouped, 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>
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!