How to Set Color of Progress Bar using HTML and CSS ?

The progress bar is an important element on 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. 

The progress bar is used to represent the progress of a task. It is also defined how much work is done and how much is left to download a thing. It is not used to represent the disk space or relevant query.

Example 1: In this example, we will set the color of progress bar.

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to Set Background Color of
        Progress Bar using HTML and CSS?
    </title>
    <style>
      
        /* For Firefox */
        progress::-moz-progress-bar {
            background: green;
        }
  
        /* For Chrome or Safari */
        progress::-webkit-progress-value {
            background: green;
        }
  
        /* For IE10 */
        progress {
            background: green;
        }
    </style>
</head>
  
<body>
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h4>
        Set Background Color of Progress
        Bar using HTML and CSS
    </h4>
  
    <progress value="40" max="100"></progress>
</body>
  
</html>

chevron_right


Output:



Example 2: In this example, we will set the color and background color of progress bar.

HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to Set Background Color of
        Progress Bar using HTML and CSS?
    </title>
    <style>
  
        /* For Chrome or Safari */
        progress::-webkit-progress-bar {
            background-color: #eeeeee;
        }
  
        progress::-webkit-progress-value {
            background-color: #039603 !important;
        }
  
  
        /* For Firefox */
        progress {
            background-color: #eee;
        }
  
        progress::-moz-progress-bar {
            background-color: #039603 !important;
        }
  
        /* For IE10 */
        progress {
            background-color: #eee;
        }
  
        progress {
            background-color: #039603;
        }
    </style>
</head>
  
<body>
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h4>
        Set Background Color of Progress
        Bar using HTML and CSS?
    </h4>
  
    <progress value="40" max="100"></progress>
</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.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.