在css计算函数中使用模数 [英] Using modulus in css calc function
本文介绍了在css计算函数中使用模数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法在css calc函数中使用或实现模运算符吗?
我知道有mod运算符和IE支持它,但是其他浏览器呢?
Is there any way to use or implement modulus operator in css calc function?
I know there is mod operator and IE supports it, but what about other browsers?
例如
#element-id{
width: calc( 100% mod 5 );
}
推荐答案
没有提到 mod 运算符rel = nofollow>最近的规格。
Unfortunately, there is no more mention of the mod
operator in recent specs.
calc ,减法( - ),乘法(*)和除法(/)作为组件值。
The calc() function allows mathematical expressions with addition (+), subtraction (-), multiplication (*), and division (/) to be used as component values.
使用javascript来实现这种行为。
You may want to resort to using javascript to achieve such behaviour.
var el = document.getElementById('element-id');
el.style.width = (100 % 5) + '%';
这篇关于在css计算函数中使用模数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文