How to specify a label for an optgroup tag in HTML5 ? Last Updated : 17 Mar, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The HTML <optgroup> element creates a grouping of options within a <select> element. The HTML <optgroup> label Attribute text is used to specify a label for an option-group. The disabled attribute is used to specify that an option-group should be disabled. Syntax: <optgroup label="name"> Example 1: The following example demonstrates the simple optgroup tag in HTML5. HTML <!DOCTYPE html> <html> <body> <h1>The optgroup element</h1> <form action=""> <label for="travel">Choose a mode to travel:</label> <select name="travel" id="travel"> <optgroup label="Two Wheelers"> <option value="cycle">Cycle</option> <option value="motor_cycle">Motor Cycle</option> </optgroup> <optgroup label="Four Wheelers"> <option value="car">Car</option> <option value="bus">Bus</option> </optgroup> </select> <br><br> <input type="submit" value="Submit"> </form> </body> </html> Output: Example 2: The following example demonstrates the optgroup tag with a disabled attribute. HTML <!DOCTYPE html> <html> <body> <h1>The optgroup element</h1> <form action="/action_page.php"> <label for="food_chain">Choose an animal:</label> <select name="food_chain" id="food_chain"> <optgroup label="Herbivores"> <option value="cow">Cow</option> <option value="deer">Deer</option> </optgroup> <optgroup label="Carnivores"> <option value="tiger">Tiger</option> <option value="lion">Lion</option> </optgroup> <optgroup label="Omnivores" disabled> <option value="dog">Dog</option> <option value="fox">Fox</option> </optgroup> </select> <br><br> <input type="submit" value="Submit"> </form> </body> </html> Output: optgroup tag with disabled attribute Comment More infoAdvertise with us Next Article How to specify a label for an optgroup tag in HTML5 ? S subham348 Follow Improve Article Tags : Web Technologies HTML HTML5 HTML-Tags HTML-Questions +1 More Similar Reads How to specify a shorter label for an option in HTML5 ? The HTML option label attribute specifies the text value that defines the option's shorted label. In the drop-down list, the shorter version will be shown. An object stored in a <select>, <optgroup>, or <datalist> element is defined by the HTML <option> element. As a result, 2 min read How to specify a name for the output element in HTML? The name attribute specifies the name of an <output> element. It is used to reference form data after it has been submitted, or to reference the element in JavaScript. The <output> tag is used to represent the result of a calculation. The HTML <for> type attribute is used because i 1 min read How to specify the name for drop-down list in HTML5 ? Drop-down lists are also another way to allow people to choose only one choice from a number of alternatives. Since the default option is usually the first item on the list, using the drop-down list can be a safe choice if you know that one option is always preferred over the others. The drop-down l 4 min read How to specify that an option-group should be disabled in HTML5 ? We will use <optgroup> and <option> tags to create an option-group list and use the disabled attribute with <optgroup> to create a disabled option-group list. The <optgroup> tag is used to create a group of the same category options in a drop-down list. The <optgroup> t 1 min read How to specify that an option should be disabled in HTML5 ? The <select> tag is used to create a drop-down list in an HTML document. Generally, it is used in the forms when some data is to be collected from the user. By default, all the values or options can be chosen or selected from the drop-down list created using the <select> element. However 2 min read Like