Here, we will introduce you to about <optgroup> tag of
HTML5.With the help of this tag, you can make group of related option with a
label. The label is a attribute of specifying name of group.
Attributes of optgroup:
| Attributes | Value | Description |
| disabled | disabled or empty string or empty | Element can not receives focus of user. |
| label | string | Name of group |
| <optgroup label="text"> option tag</optgroup > |
|
<!doctype html > <html > <head> <title>optgroup tag.</title> </head><body> <h1>Example of optgroup tag in HTML5.</h1> <select style="width: 178px"> <optgroup label="Programming Language" > <option>C</option> <option>C++</option> <option>Java</option></optgroup> <optgroup label="Language"> <option>Hindi</option> <option> English</option> <option>Urdu</option> </optgroup> <optgroup label="Gender" disabled="disabled"> <option>Male</option> <option>Female</option></optgroup> </select></body> </html> |

The optgroup tag is available in both HTML5 and HTML4.01. So no difference.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.