嵌套计算操作 [英] Nested calc operations
本文介绍了嵌套计算操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
希望这很简单.我想使用CSS calc操作来执行两个计算:
Hopefully this is quite simple. I want to use the CSS calc operation to perform two calculations:
我想将宽度设置为等于
(100% / 7) - 2
但是,如果我尝试在CSS calc操作中执行多个操作,则会失败:
However if I try to perform more than one operation in a CSS calc operation, it fails:
width: calc((100% / 7) - 2);
如何在一个CSS语句中执行多个计算操作?
How can I perform multiple calc operations in one CSS statement?
推荐答案
显然,您必须将px
或%
分配给所有未被乘或除的数字.
Apparently you have to assign px
or %
to all numbers that are not being multiplied or divided.
width: calc((100% / 7) - 2px);
好吧,我现在觉得很蠢.哈哈.
Well I feel dumb now. Haha.
这篇关于嵌套计算操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文