0

Hi I'm wondering if there's a way I can use a combination of units of measurements in LESS's calc function. If not, does sass or any other CSS preprocessor have this capability?

e.g. something like:

.target {
    height: calc(5rem-1px); //FYI, this doesn't work I tried it.
}

Thank You!

wonghenry
  • 575
  • 2
  • 6
  • 18
  • 2
    add spaces around the minus, that should work. – Wim Mertens Jan 26 '17 at 02:14
  • I'm using Sass and that definitely works, don't know about Less but more info in this post: http://stackoverflow.com/questions/17904088/disable-less-css-overwriting-calc/24790931#24790931 – Wim Mertens Jan 26 '17 at 02:19
  • But `calc` is not a Less function (Less does not need any `calc` to [evaluate an arithmetic expression](http://lesscss.org/features/#features-overview-feature-operations), though you can't expect it can automatically translate rems to pixels and back since at the compilation time the font the rem unit corresponds to is unknown). `calc` is a [CSS function](https://developer.mozilla.org/en/docs/Web/CSS/calc) actually. And most likely (not counting the missing spaces around `-` which is valid point too) your problem is just: http://stackoverflow.com/questions/11972084. – seven-phases-max Jan 26 '17 at 02:37
  • 1
    Yea, that's what I thought @seven-phases-max and hence closed as a dupe. Waiting to see if OP has any problems even after doing those suggested changes. – Harry Jan 26 '17 at 06:28

0 Answers0