css3 - css @keyframe 能带小数吗
黄舟
黄舟 2017-04-17 11:14:18
0
1
647

比如 10.3% 如果可以精确度是多少?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
左手右手慢动作

Yes, but you can only keep up to 2 decimal points.

@keyframes myAnimation {
    0% { height: 100px; }
    33.3% { height: 120px; }
    66.6% { height: 140px; }
    100% { height: 200px; }
}

When it comes to CSS it takes notice of percentages down to 2 decimal places and then stops. So you would be able to get 33.34% but not 33.3457% for use in your keyframes

Related links on SO:

Is it allowed to use any decimal value in CSS keyframe animations?

Can you use more than a whole number with @keyframe percents?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template