2

I am looking for a working solution, to animate the background-position property of an progress element in /.

HTML:

<progress max="100" value="0"></progress>

CSS:

progress[value]::-webkit-progress-bar {
  -webkit-animation: moveBackground 2s steps(30) infinite;
  background-image: repeating-linear-gradient(to right, green 0%, orange 50%, blue 100%);
  background-size: 30rem;
}

@-webkit-keyframes moveBackground
{
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: -50rem 0;
  }
}

Fiddle: https://jsfiddle.net/6gekeegg/

However, supports the animation of the background-position property, simple example:

progress[value] {
  ...
}
mate64
  • 9,876
  • 17
  • 64
  • 96

2 Answers2

0

animation property should be prefixed

-webkit-animation: moveBackground 2s steps(30) infinite;

fiddle

vals
  • 61,425
  • 11
  • 89
  • 138
0

Update: 11. Mar. 2015:

<=41 seems not to support animations for the background-position attribute of progress elements.

I have created a working solution with the ::after pseudo-element:

https://jsfiddle.net/x7urfdev/

Please note: does not support the ::after or ::before pseudo-elements on progress elements.

mate64
  • 9,876
  • 17
  • 64
  • 96