Less aggressive compilation with CSS3 calc

前端 未结 4 1584
臣服心动
臣服心动 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条回答
  •  野的像风
    2020-11-22 05:49

    There's a tidier way to include variables inside the escaped calc, as explained in this post: CSS3 calc() function doesn't work with Less #974

    @variable: 2em;
    
    body{ width: calc(~"100% - @{variable} * 2");}
    

    By using the curly brackets you don't need to close and reopen the escaping quotes.

提交回复
热议问题