Open In App
Related Articles

How to create a group of related options in a drop-down list using HTML ?

Improve Article
Save Article
Like Article

We can define a group of related options in a drop-down list by using the <optgroup> Tag tag is used to create a group of same category options in a drop-down list. The tag is required when there is a long list of items.


<!DOCTYPE html>
        How to define a group of
        related options in a
        drop-down list?
        body {
            text-align: center;
        .gfg {
            font-size: 40px;
            font-weight: bold;
            color: green;
        .geeks {
            font-size: 17px;
    <div class="gfg">GeeksforGeeks</div>
    <div class="geeks">
        A computer science portal for geeks
        How to define a group of related
        options in a drop-down list
        <optgroup label="Programming Languages">
            <option value="C">C</option>
            <option value="C++">C++</option>
            <option value="Java">Java
        <optgroup label="Scripting Language">
            <option value="JavaScript">JavaScript</option>
            <option value="PHP">PHP</option>
            <option value="Shell">Shell</option>


Supported Browsers are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 20 May, 2020
Like Article
Save Article
Similar Reads
Related Tutorials