Other answers do not seem to work.
According to the LESS documentation , the unit() function will remove or change the unit of measure. Since a function accepts only one dimension as a parameter (and an optional parameter), you should use the following:
unit((@baseLineHeight/@baseFontSize))
Due to strict math , you will notice that the line above may need to be wrapped in parentheses so that the math is actually evaluated.
@baseFontSize: 12px; @baseLineHeight: 18px; p { font: @baseFontSize ~"/" unit((@baseLineHeight/@baseFontSize)) sans-serif; }
LESS above will output the following desired results:
p { font: 12px / 1.5 sans-serif; }
Josh crozier
source share