html tutorial - <optgroup> Optgroup Tag in HTML - html5 - html code - html form

optgroup tag in html

Learn html - html tutorial - optgroup tag in html - html examples - html programs

  • The <optgroup> tag is used to collect relevant options in a drop-down list within a <select> element.
  • Whenever we have a lengthy list of options, groups of similar options are simple to hold for a user.
  • The <optgroup> tag supports Global Attributes and Event Attributes.

Syntax for <optgroup> tag:

<optgroup label = “GroupHeading”>

Sample Coding for <optgroup> tag in HTML:

Tryit<!DOCTYPE html>
<html >
            <optgroup label="WEB DEVELOPMENT IN WIKITECHY">
                <option value="css">CSS</option>
                <option value="html">HTML</option>
            <optgroup label="PROGRAMMING TECHNOLOGY IN WIKITECHY">
                <option value="java">JAVA</option>
                <option value="c">C</option>

Code Explanation for <optgroup> tag:

<optgroup> Tag Code Explanation

  1. <optgroup> tag is used to group the related contents in a drop-down list.
  2. label is an attribute, which tends to describe the title/caption for an option-group.

Output for <optgroup> tag:

<optgroup> Tag Output

  1. By clicking the dropdown list the option values is displayed in the option group.
  2. CSS, HTML, JAVA & C are the Option Values.

Attributes of <optgroup> tag:

Attribute Value HTML4 HTML5 Description
label disabled Yes Yes Describes a label for an option-group.
disabled text Yes Yes Defines if an option-group should not be shown.

Browser Support for <optgroup> tag in HTML:

Yes Yes Yes Yes Yes

Related Searches to optgroup tag in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.