Is it possible to set the color of the "bar" for the <progress>
element in HTML (when you specify a value, the bar is filled up to the point of the value)? If so, how? background-color
and background
don't seem to have any effect. Is the technique cross compatible with the latest version of all browsers?
8 Answers
You can style the color of the bar in the <progress>
element by changing the background
of a few browser-proprietary selectors.
In Firefox, you can use the following:
progress::-moz-progress-bar { background: blue; }
In Chrome or Safari, you can use:
progress::-webkit-progress-value { background: blue; }
In IE10, you just need to use the color
attribute:
progress { color: blue; }
Source: http://html5doctor.com/the-progress-element/
Altogether, that makes:
progress::-moz-progress-bar { background: blue; }
progress::-webkit-progress-value { background: blue; }
progress { color: blue; }
<progress value="0" max="100"></progress><br>
<progress value="25" max="100"></progress><br>
<progress value="50" max="100"></progress><br>
<progress value="75" max="100"></progress><br>
<progress value="100" max="100"></progress><br>

- 136,138
- 45
- 251
- 267

- 10,545
- 3
- 45
- 63
-
2If the progress element had an id of 'myprogressbar', then how would you do the Chrome one? #myprogressbar{-webkit-progress-value{background:blue}} does not appear to work. – Rolando Aug 21 '13 at 21:50
-
1It should be `#myprogressbar::-webkit-progress-value {background: blue; }` – nullability Aug 21 '13 at 21:53
-
1@nullability sorry for the bump, but I tried what you suggested (in regards to attaching it to a class) and it didn't work, could you please show me an example through JSFiddle? Not sure what to Google to find out how to do it... – Script47 Mar 28 '16 at 14:48
-
1if i trying to change any other color it automatically changed as green color how to fix this – R.Anandan Dec 15 '16 at 10:13
-
Linux Chromium, this does not work. Seems like it broke since this answer was posted. On Firefox, it does. Edit: Up to date solution can be found [here](https://stackoverflow.com/a/21141230/3779853). – phil294 Jan 15 '20 at 20:25
-
1This works too. EX: IF you have the latest chrome installed. – MTMDev Apr 07 '22 at 14:02
Blink / Chrome
background-color
To color the background-color
of a progress
element (the part that does not increase/decrease) in WebKit browsers use the following:
progress::-webkit-progress-bar {background-color: #000; width: 100%;}
color
To color the effective color
of the moving part of a progress
element use the following:
progress::-webkit-progress-value {background-color: #aaa !important;}
Gecko / Firefox
background-color
To color the background-color
of a progress
element (the part that does not increase/decrease) in Gecko browsers use the following:
progress {background-color: #000;}
color
To color the effective color
of the moving part of a progress
element use the following:
progress::-moz-progress-bar {background-color: #aaa !important;}
Presto / Opera
I've unofficially dropped support for Opera since they've stopped developing it. For those confused and think Opera is still being developed - that is just an obviously rebranded copy of Chrome. Do not test browsers, test engines!
Trident / Internet Explorer (and "Edge")
When Microsoft actually makes the effort they really do actually come through, this one actually makes perfect straight-forward sense.
background-color
progress {background-color: #000;}
color
progress {color: #aaa;}
WebKit / Safari
At some point WebKit/Safari stopped working with Chrome (or vice-versa); this is tested on Safari 14.0.3 as of 2021-03-13.
background-color
progress[value]::-webkit-progress-bar {background-color: #000;}
color
progress[value] {-webkit-appearance: none;}
progress[value]::-webkit-progress-value {background-color: #fff;}
Putting it all together, that makes:
/* background: */
progress::-webkit-progress-bar {background-color: black; width: 100%;}
progress {background-color: black;}
/* value: */
progress::-webkit-progress-value {background-color: green !important;}
progress::-moz-progress-bar {background-color: green !important;}
progress {color: green;}
<progress value="0" max="100"></progress><br>
<progress value="25" max="100"></progress><br>
<progress value="50" max="100"></progress><br>
<progress value="75" max="100"></progress><br>
<progress value="100" max="100"></progress><br>

- 1
- 13
- 98
- 177
progress {
accent-color: red;
}

- 442
- 6
- 14
-
1Shockingly, this works, but also sets the background to a charcoal black. – PRMan Jul 02 '22 at 18:39
Each browser seems to handle progress bar styling differently at the moment, and therefore you need to style it like this:
progress {
/* style rules */
}
progress::-webkit-progress-bar {
/* style rules */
}
progress::-webkit-progress-value {
/* style rules */
}
progress::-moz-progress-bar {
/* style rules */
}
WebKit
styles for Chrome and Safari and moz
styles for Firefox.
From here you can simply add a background colour with background-color
.
Good Luck! Any queries, drop me a comment below.

- 678
- 4
- 14
-
2If i do this, it does not show progress and fills whole bar with the color – Zia Ul Rehman Mughal Jan 08 '20 at 13:29
The preferred method going forward for modern browsers is accent-color
.
Used as shown:
progress { accent-color: blue; }
/*or*/
#ID, .class { accent-color: blue; }
It seems that Chrome has already dropped support for its -webkit-progress
psuedo-selectors, and Firefox's implementation is buggy and likely to be dropped as well. accent-color
is supported by Firefox, Chrome and Safari, and is currently the only method with specifications, although they're still in drafting.
Note: Chrome (and by extension, Edge) currently automatically switches the background color from white to dark grey, depending on how bright the accent color is.

- 552
- 1
- 4
- 14
On top of the accepted answerhere you might want to add
/* Reset the default appearance */
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
See this answer

- 416
- 5
- 10
progress::-moz-progress-bar {background-color: #C8DED8;}
progress::-webkit-progress-bar {background-color: #C8DED8;}
progress::-webkit-progress-value {background-color: #E7B92A;}
progress {border-radius: 8px; overflow: hidden; height: 6px;}
-
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 21 '23 at 00:42
As of August 2023, this is the simplest way I've found to recolor progress bars in Chrome, Firefox and Safari. accent-color
doesn't seem to work. But you can set color
on the progress
element and then reference it in the various pseudo-classes you need, so if you want progress bars in multiple colors, you only need to change one property.
progress {
color: darkmagenta;
/* Firefox: Unfilled portion of the progress bar */
background: lightgrey;
}
/* Firefox: Filled portion of the progress bar */
progress::-moz-progress-bar {
background: currentColor;
}
/* Chrome & Safari: Unfilled portion of the progress bar */
progress::-webkit-progress-bar {
background: lightgrey;
}
/* Chrome & Safari: Filled portion of the progress bar */
progress::-webkit-progress-value {
background: currentColor;
}
/* Easily change the color */
progress.red {
color: darkred;
}
progress.blue {
color: darkblue;
}
<progress value=".25">25%</progress> <br/>
<progress value=".33" class="red">33%</progress> <br/>
<progress value=".5" class="blue">50%</progress>
You can apply more rules, like border
and border-radius
, to each of the selectors above to further style your progress bar, like so:
progress {
color: darkmagenta;
height: 9px;
width: 100%;
border-radius: 10px;
/* Firefox: Unfilled portion of the progress bar */
background: white;
border: 1px solid currentColor;
}
/* Firefox: Filled portion of the progress bar */
progress::-moz-progress-bar {
background: currentColor;
border-radius: 10px;
}
/* Chrome & Safari: Unfilled portion of the progress bar */
progress::-webkit-progress-bar {
background: white;
border-radius: 10px;
}
/* Chrome & Safari: Filled portion of the progress bar */
progress::-webkit-progress-value {
background: currentColor;
border-radius: 10px;
}
/* Easily change the color */
progress.red {
color: darkred;
}
progress.blue {
color: darkblue;
}
<progress value=".25">25%</progress> <br/>
<progress value=".33" class="red">33%</progress> <br/>
<progress value=".5" class="blue">50%</progress>

- 1,426
- 14
- 26