Nick Babcock Nick Babcock - 10 months ago 74
CSS Question

Less Aggressive Compilation with CSS3 calc

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

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


body { width: calc(-151.5%); }

Which is obviously not desired. I'm wondering if there is a way to signal to the Less compiler to essentially ignore the attribute during compilation. I've searched through the Less documentation and both compilers' documentation and I could not find anything.

Does Less or a Less compiler support this?

If not, is there a CSS extender that does?


do this..

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

In less.js 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.