此SCSS函数的语法不正确吗?未定义的操作错误:

时间:2019-05-05 15:40:33

标签: css sass

@return($ page-width-$ gap *($ columns -1)/ $ columns)

错误说;

Error: Undefined operation: "1% times 8 -1".
        on line 14 of Users/amberjones/Desktop/Sass_Scss_first/sass-project/scss/partials/_functions.scss, in function `col-width`
        from line 15 of Users/amberjones/Desktop/Sass_Scss_first/sass-project/scss/partials/_variables.scss
        from line 2 of sass/Users/amberjones/Desktop/Sass_Scss_first/sass-project/scss/main.scss
>>   @return ($page-width - $gap*($columns -1 ) / $columns)```

1 个答案:

答案 0 :(得分:0)

错误似乎出在函数col-width的_functions.scss中。 无法将百分比和整数相乘。 您必须将所有都转换为整数,然后使用函数percentage()再次进行转换: percentage function

仅允许对整数进行操作