Less aggressive compilation with CSS3 calc

前端 未结 4 1577
臣服心动
臣服心动 2020-11-22 05:18

The Less compilers that I\'m using (OrangeBits and dotless 1.3.0.5) are aggressively translating

body { width: calc(100% - 250px - 1.5em); }
<
4条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 06:14

    Less no longer evaluates expression inside calc by default since v3.00.


    Original answer (Less v1.x...2.x):

    Do this:

    body { width: calc(~"100% - 250px - 1.5em"); }
    

    In Less 1.4.0 we will have a strictMaths option which requires all Less calculations to be within brackets, so the calc will work "out-of-the-box". This is an option since it is a major breaking change. Early betas of 1.4.0 had this option on by default. The release version has it off by default.

提交回复
热议问题