错误:函数 rgb 在 SASS 中缺少参数 $green

Afn*_*mad 17 html css sass

我在使用SCSS编写CSS文件时遇到错误,
错误如下:

Error: Function RGB is missing in argument $green.
       on line 116 of sass/c:\Users\User\Desktop\This PC\style.scss
>>     background-color:RGB(111 197 236 / 49%);
Run Code Online (Sandbox Code Playgroud)

HTML和SCSS代码如下:

Error: Function RGB is missing in argument $green.
       on line 116 of sass/c:\Users\User\Desktop\This PC\style.scss
>>     background-color:RGB(111 197 236 / 49%);
Run Code Online (Sandbox Code Playgroud)
.header-hover:hover{
    background-color: rgb(111 197 236 / 49%);
}
Run Code Online (Sandbox Code Playgroud)

我使用很棒的字体来获取图标。

小智 37

sass 尚未赶上新标准,因此尝试使用rgba(111, 197, 236, 0.49);而不是rgb(111 197 236 / 49%)


Jou*_*aas 7

如果你想或者必须使用新的语法,你可以使用大写字母RGB来代替,sass 会忽略它。

.header-hover:hover{
    background-color: RGB(111 197 236 / 49%);
}
Run Code Online (Sandbox Code Playgroud)

当您使用无法控制的 CSS 变量时,这尤其有用:

.header-hover:hover{
    background-color: RGB(var(--color-blue) / 49%);
}
Run Code Online (Sandbox Code Playgroud)