Sass cannot perform arithemetic operations on strings, only concatenation. When you use interpolation, what you've created is a string that looks like a number:
@debug type-of(#{10px}); // string
@debug type-of('10px'); // string
@debug type-of(unquote('10px')); // string
@debug type-of(10px); // number
If you want a number, do not use interpolation and do not use quotes. For converting an integer (eg. 10
) to a length (eg. 10px
), use multiplication:
$gutter-em: ($gutter / $em) * 1em;
@debug type-of($gutter-em); // number
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…