禁用LESS-CSS覆盖calc() [英] Disable LESS-CSS Overwriting calc()

查看:235
本文介绍了禁用LESS-CSS覆盖calc()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我试图在CSS3中在我的LESS代码中这样做:

  width:calc 200px);但是,当LESS编译它输出:








$ b b

  width:calc(-100%); 

有没有办法告诉LESS不要以这种方式编译并正常输出? / p>

解决方案

使用 转义字符串 (又称为转义值):

  width:〜calc (100%-200px); 






此外,如果您需要混合Less数学

  width:calc(〜100% -  15rem +(10px + 5px)〜+ 2em ); 

编译为:

  width:calc(100% -  15rem + 15px + 2em); 

这是默认情况下使用空格连接值的值(转义字符串和数学运算结果) / p>

Right Now I'm trying to do this in CSS3 in my LESS code:

width: calc(100% - 200px);

However, when LESS compiles it is outputting this:

width: calc(-100%);

Is there a way to tell LESS not to compile it in that manner and to output it normally?

解决方案

Using an escaped string (a.k.a. escaped value):

width: ~"calc(100% - 200px)";


Also, in case you need to mix Less math with escaped strings:

width: calc(~"100% - 15rem +" (10px+5px) ~"+ 2em");

Compiles to:

width: calc(100% - 15rem + 15px + 2em);

This works as Less concatenates values (the escaped strings and math result) with a space by default.

这篇关于禁用LESS-CSS覆盖calc()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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