是否允许在CSS关键帧动画中使用任何十进制值? [英] Is it allowed to use any decimal value in CSS keyframe animations?

查看:148
本文介绍了是否允许在CSS关键帧动画中使用任何十进制值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用这样的百分比值:

I'm wondering if it's ok to use percentage values like this:

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

它似乎工作,但我不知道如果浏览器可能只是圆这个?而值如33.3457%呢?
非常感谢!

It seems to work, but it I am not sure if the browsers might just "round" this? And what about values like 33.3457%? Thanks a lot!

推荐答案

当涉及CSS时,它注意到百分比下降到2个小数位,然后停止。所以你可以在关键帧中使用33.34%,但不能是33.3457%。

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

我希望这会有帮助。

这篇关于是否允许在CSS关键帧动画中使用任何十进制值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆