gpt4 book ai didi

css - SASS 错误 : Incompatible units: 'px' and 'px*px'

转载 作者:技术小花猫 更新时间:2023-10-29 11:31:21 28 4
gpt4 key购买 nike

我正在使用 SCSS 更改 bootstrap 4 的样式以创建我自己的样式,但是当我编译 SCSS 时出现此错误:

{
"status": 1,
"file": "H:/!WEBSITE/modules/The Force - Bootstrap/content/scss/variables/variables.scss",
"line": 330,
"column": 34,
"message": "Incompatible units: 'px' and 'px*px'.",
"formatted":
"Error: Incompatible units: 'px' and 'px*px'.
on line 330 of scss/variables/variables.scss
>> $input-height: (($font-size-base * $input-line-height) + ($input-padding-y * 2)) !default;"
}


我的变量值:

$font-size-base:          14px !default;
$line-height-base: 1.846 !default;
$input-line-height: floor(($font-size-base * $line-height-base)) !default;
$input-padding-y: 6px !default;


弹出错误的行:

$input-height: (($font-size-base * $input-line-height) + ($input-padding-y * 2)) !default;


我不明白为什么它不起作用,更不知道如何修复它。我用 node-sass 编译 SCSS,我不认为问题出在 node-sass 上,因为这不是我第一次使用它,而且我一整天都在使用它,没有遇到任何此类错误。

最佳答案

您的问题是您将 pxpx 相乘,结果是 px2

因此从变量 $font-size-base 中删除 px

$font-size-base:          14 !default;
$line-height-base: 1.846 !default;
$input-line-height: floor(($font-size-base * $line-height-base)) !default;
$input-padding-y: 6px !default;
$input-height: (($font-size-base * $input-line-height) + ($input-padding-y * 2)) !default;

关于 Sass 单元的更多信息 here

关于css - SASS 错误 : Incompatible units: 'px' and 'px*px' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42797624/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com