0

I am using the math option parens-division. Please do not suggest using strict/legacy to resolve this issue.

What I ultimately want is this: calc(100% - 13.75rem)

However, I want to use variables in my defintion. With parens-division I had

@subtract: (220/16rem); // hack to work-around nested math interpretations
.zzz {
    width: calc(~"100% -" @subtract);
}

After updating some of my builds I started getting errors on (220/16rem) so now I have tried

@subtract: (220/16); // hack to work-around nested math interpretations
.zzz {
    width: calc(~"100% - @{subtract}rem");
}

but with no success. Help appreciated

3
  • you cannot divide by a unit in calc Commented Oct 15, 2018 at 13:57
  • on lesscssismore.com/ljshn6 it seems working fine Commented Oct 15, 2018 at 14:01
  • Have you tried (220rem / 16), putting the unit on the numerator instead of denominator? Commented Oct 15, 2018 at 14:02

1 Answer 1

1

I've created a pen to test a combination of your solutions.

Seems to be working:

@subtract: (220/16rem); // hack to work-around nested math interpretations
.zzz {
    background: red;
    height: 50px;
    width: calc(~"100% - @{subtract}");
}

https://codepen.io/anon/pen/dgZWVe

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.