Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the color of a progress bar value in HTML?

progress {
  border: none;
  width: 400px;
  height: 60px;
  background: crimson;
}

progress {
  color: lightblue;
}

progress::-webkit-progress-value {
  background: lightblue;
}

progress::-moz-progress-bar {
  background: lightcolor;
}
<div>
  <progress min="0" max="100" value="63" />
</div>

I have tried nearly everything, but the value color of the progress bar remains the same. The only browser that is responsive to a change is IE. Firefox allows to change background color only. Chrome doesn't show anything at all. Can you spot what is wrong with my code?

like image 623
CeeJay Avatar asked Aug 04 '17 13:08

CeeJay


People also ask

How do I change the color of my progress bar in HTML?

For these properties to work, first thing you'll need to set the appearance of the progress element to none . The first one is the ::-webkit-progress-bar pseudo-element. It represents the entire progress element. You can use it to set the background color.

How do you style a progress tag in HTML?

In the stylesheet, we actually can use the element selector to target and add style rules to <progress> element. In this example, we change the background color, remove the border line, and make it rounded by adding a border radius at half of its height.

How do I customize my progress bar?

Customizing a ProgressBar requires defining the attribute or properties for the background and progress of your progress bar. You can do this in the XML file or in the Activity (at run time). @hirengamit res is "Resource".

How can get progress bar value in HTML?

The progress object in HTML DOM is used to represent the HTML <progress> element. The <progress> element can be accessed by using getElementById() method. Property Values: level: It returns the list of progress bar.


1 Answers

progress {
  border: none;
  width: 400px;
  height: 60px;
  background: crimson;
}

progress {
  color: lightblue;
}

progress::-moz-progress-bar {
  background: lightcolor;
}

progress::-webkit-progress-value {
  background: red;
}

progress::-webkit-progress-bar {
  background: blue;
}
It will work on webkit browser, like this example

<div>
  <progress min="0" max="100" value="63" />
</div>
like image 71
Renzo Calla Avatar answered Sep 21 '22 21:09

Renzo Calla