aknuds1 aknuds1 - 7 months ago 129
CSS Question

How to use a Stylus variable in calc?

In Stylus, how do I use a variable in a calc expression?

For example, the following doesn't work (

being a variable):

arrow-size = 5px
left calc(50% - arrow-size)


In order to use a Stylus variable inside a calc expression, one must use string interpolation:

arrow-size = 5px
left "calc(50% - %s)" % arrow-size