Change the color of the progress element

1

I want to change the color of the progress bar, but I'm not getting it, how can I change the color of the <progress> element by css?

    
asked by anonymous 27.04.2018 / 20:14

1 answer

2

You can change the colors by changing the value of background-color in the pseudo-elements below:

  • ::-moz-progress-bar
  • ::-ms-fill
  • ::-webkit-progress-bar
  • ::-webkit-progress-value
  • ::-webkit-progress-inner-element

Example commenting:

progress {
  /* Altera a cor do background no Firefox e navegadores da Microsoft */
  background: yellow;

  /* É necessário alterar o valor para none */
  -webkit-appearance: none;
}

/* Altera a cor de fundo em navegadores com webkit (Chrome, Safari etc) */
::-webkit-progress-value {
  background-color: orange;
}

/* Altera a cor da barra em navegadores com webkit (Chrome, Safari etc) */
::-webkit-progress-bar {
  background-color: green;
}

/* Altera a cor da barra em navegadores com moz (Firefox) */
::-moz-progress-bar {
  background-color: blue
}

/* Altera a cor da barra em navegadores da Microsoft (IE e Edge) */
::-ms-fill {
  background-color: purple
}
<progress value="10" max="50">
    
27.04.2018 / 20:27