How to create a progress bar using HTML and CSS?

The progress bar is an important element in the web, the progress bar can be used for downloading, marks obtained, skill measuring unit, etc. To create a progress bar we can use HTML and CSS. To make that progress bar responsive you will need JavaScript.

In this article, we will learn to create progress bars using HTML and CSS. A progress bar is created by using two HTML “div”, the container (parent div), and the skill (child div) as shown in the following examples.

Example 1: We will divide the article into two coding sections, in the first section we will work on HTML, and in the second section will design that progress bar.

  • HTML Code: We create a parent div that will define the full length unit and the child div will define the obtain unit.
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html>
    <html>
    <head>
        <title>Design a Progress bar</title>
    </head>
    <body>
        <h1>My Skills</h1>
        <p>HTML</p>
        <div class="container">
            <div class="skill html">80%</div>
        </div>
      
        <p>PHP</p>
        <div class="container">
            <div class="skill php">60%</div>
        </div>
    </body>
      
    </html>

    chevron_right

    
    

  • CSS Code: By using CSS we will decorate both the div, colored the full and obtain unit. Set the length of the divs also.
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <style>
        p {
            font-size: 20px;
        }
      
        .container {
            background-color: rgb(192, 192, 192);
            width: 80%;
            border-radius: 15px;
        }
      
        .skill {
            background-color: rgb(116, 194, 92);
            color: white;
            padding: 1%;
            text-align: right;
            font-size: 20px;
            border-radius: 15px;
        }
      
        .html {
            width: 80%;
        }
      
        .php {
            width: 60%;
        }
    </style>

    chevron_right

    
    

Final Code: Here we will combine the above two coding section.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<head>
    <style>
        p {
            font-size: 20px;
        }
      
        .container {
            background-color: rgb(192, 192, 192);
            width: 80%;
                border-radius: 15px;
        }
      
        .skill {
            background-color: rgb(116, 194, 92);
            color: white;
            padding: 1%;
            text-align: right;
            font-size: 20px;
                border-radius: 15px;
        }
      
        .html {
            width: 80%;
        }
      
        .php {
            width: 60%;
        }
    </style>
</head>
<body>
    <h1>My Skills</h1>
    <p>HTML</p>
    <div class="container">
        <div class="skill html">80%</div>
    </div>
  
    <p>PHP</p>
    <div class="container">
        <div class="skill php">60%</div>
    </div>
</body>
</html>

chevron_right


Output:

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.