css在IE11中的计算错误 [英] css calc bug in IE11

查看:243
本文介绍了css在IE11中的计算错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是演示 http://codepen.io/blaja/pen/krdwc/

IE11似乎没有计算 calc(50% - 1rem),但所有其他浏览器都是。 / p>

我该如何解决这个问题?

解决方案

这个答案 ,显然有一个flexbox和IE11如何处理它的错误。也就是说,IE11中的 flex 速记不能像你试图做的那样使用 calc()

这台机器没有IE11,所以我不能为你测试任何解决方案,也不是我对flexbox的真正经验,而是尝试写出属性你想使用(如增长,缩小,基础)在长期形式。编辑:经过一些进一步的研究,一个潜在的原因为此是IE11正试图做一些愚蠢的像结合值允许小数。你有没有试过像 calc((50%) - (1rem))


Here is the demo http://codepen.io/blaja/pen/krdwc/

IE11 does not seem to calculate calc(50% - 1rem), but all other browsers do.

How can I fix it?

解决方案

According to this answer, there is apparently a bug with flexbox and how IE11 handles it. Namely, you cannot use calc() with the flex shorthand in IE11 as you are trying to do.

I don't have IE11 on this machine, so I can't test any solution for you, nor am I really experienced with flexboxes, but try writing out the property you want to use (e.g. grow, shrink, basis) in long form.

EDIT: After some further research, a potential reason for this is that IE11 is trying to do something stupid like combine values to allow for decimals. Have you tried something like calc((50%) - (1rem))?

这篇关于css在IE11中的计算错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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