Chrome CSS 百分比
问题很简单,webkit(或者至少是 chrome)处理某些百分比值很糟糕。
例如,如果我有一个宽度为 450px
的整体 div,如果我有两个宽度值为 7.117%
和 7.118%
的子元素>,输出将是两个 div,宽度分别为 31px
和 32px
。 (测试用例的小提琴)
或者微积分显示两者的计算宽度值 div(理论上)高于 32px
。结果是 32.0265 和 32.031。因此,这似乎不是一个子像素问题,因为将两个值四舍五入将它们四舍五入为 32。
我想知道是否有任何解决方法/最佳实践或其他方法来处理它。
The problem is simple, webkit (or at least chrome) handle some percentage value badly.
For example if I have an overall div with a width of 450px
, if I had it two child with a width value of 7.117%
and 7.118%
, the output will be two div with a respective width of 31px
and 32px
. (Fiddle of a test case)
Or a calculus shows that the calculated width value of both div is (in theory) above 32px
. The results are 32.0265 and 32.031. So that doesn't appear to be a subpixel problem as rounding down both value is rounding them to 32.
I was wondering if there were any workaround/best practice or else to deal with it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新 chrome 解决了这个问题。
最佳实践:更新您的软件。
Updating chrome fixed the issue.
Best practice: update your software.