Optgroup tag used in forms for naming a matching elements in a category.
- It is represented using <optgroup>.
Example:
- Bread, Cake, Puffs are belongs to the category of Baked items.
- Pista , Butterscotch, Blackcurrent are belongs to the category of Ice creams.
- Apple, Mango, Banana are belongs to the category of Fruits.
Step-1:How to create optgroup in HTML:
By using optgroup tag. Use lable attribute inside option tag.
<form>
Please choose your menu:
<select>
<optgroup label="Baked items">
<option value="Bread">Bread</option>
<option value="Cake">Cake</option>
<option value="Puffs">Puffs</option>
</optgroup>
</select>
</form>
Post a Comment