I am using a progress bar as described here:
http://css-tricks.com/html5-progress-element/
Using the <progress>
element and styling it with the pseudo classes
-webkit-progress-bar
and -webkit-progress-value
.
So now I want to animate the progress-value
, whenever it updates.
In my theory this should work via transitioning its CSS width attribute like this:
progress::-webkit-progress-value {
transition: 5s width;
}
But for some reason this does not seem to work.
Use the <progress> tag to create a progress bar in HTML. The HTML <progress> tag specifies a completion progress of a task. It is displayed as a progress bar.
Thus, to change the progress bar and the progress value styles in these browsers, we need to add those Webkit pseudo-classes . Firefox also has its special pseudo-class that is ::-moz-progress-bar. Unlike Chrome and Safari, this pseudo-class in Firefox refers to the progress meter/value.
CSS transitions provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect immediately, you can cause the changes in a property to take place over a period of time.
The correct syntax for the transition property is:
transition: [property] [duration] [timing-function] [delay];
then your value ( transition: 5s width;
) is wrong, timing and property are inverted, and timing function is missing. It should be (for example):
transition : width 5s ease;
It should also be prefixed to work crossbrowser, especially for WebKit based browsers, leaving the standard property as the last one.
-webkit-transition : width 5s ease;
-moz-transition : width 5s ease;
-o-transition : width 5s ease;
transition : width 5s ease;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With