Is there a way with pure CSS without javascript to animate element's width to server generated value? Let's say I have this div:
<div class="bar" style="width:{$value}%;"></div>
I would like it to animate from 0 to $value that is set by PHP on page render. So initial state forced by animation would be width: 0px and the final would be width: {$value}%;
A working solution using animation:
JSFiddle Demo
<div class="bar" style="width:80%;"></div> <!-- where 80% is the PHP value-->
.bar{
background: lime;
padding: 30px 0;
animation: test 2s;
}
@keyframes test {
0% {width: 0;}
}
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