I am attempting to use SASS for the first time on my next project (Pomodoro Clock). To get started I just wanted to declare my color variables and set a background color. When I try to apply the styling I get this error:
我试图在我的下一个项目(番茄钟)上第一次使用SASS。要开始,我只想声明我的颜色变量并设置背景颜色。当我尝试应用样式时,我收到此错误:
Invalid CSS after "...(35, 61, 77, 1)": expected expression (e.g. 1px, bold), was ";"
“......(35,61,77,1)”后的CSS无效:预期表达式(例如1px,粗体)为“;”
My code is below.
我的代码如下。
/*All variables declared*/
$japaneseIndigo: rgba(35, 61, 77, 1);
$babyPowder: rgba(255, 255, 250, 1);
$princetonOrange: rgba(254, 127, 45, 1);
$yankeesBlue: rgba(28, 48, 65, 1);
$mediumSpringGreen: rgba(24, 242, 178, 1);
/*Apply styles*/
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-color: $yankeesBlue;
}
I know this is a super simple question that shouldn't need this forum to answer but I have sincerely Googled and asked for help elsewhere without any luck. Thank you for your help.
我知道这是一个非常简单的问题,不应该需要这个论坛来回答,但我真诚地用谷歌搜索并在其他地方寻求帮助而没有任何运气。感谢您的帮助。
2 个解决方案
#1
1
Are you using sass or scss ? I dont think you are allowed to use ';' in .sass files. Got it from here : Sass Invalid CSS Error: "expected expression" And double checked : http://sass-lang.com/guide
你在使用sass还是scss?我不认为你被允许使用';'在.sass文件中。从这里得到它:Sass无效的CSS错误:“预期的表达”和双重检查:http://sass-lang.com/guide
#2
1
In Codepen, change your preprocessor from Sass to SCSS.
在Codepen中,将预处理器从Sass更改为SCSS。
See this for more info on the difference between Sass and SCSS: What's the difference between SCSS and Sass?
有关Sass和SCSS之间差异的更多信息,请参阅此内容:SCSS和Sass之间的区别是什么?
#1
1
Are you using sass or scss ? I dont think you are allowed to use ';' in .sass files. Got it from here : Sass Invalid CSS Error: "expected expression" And double checked : http://sass-lang.com/guide
你在使用sass还是scss?我不认为你被允许使用';'在.sass文件中。从这里得到它:Sass无效的CSS错误:“预期的表达”和双重检查:http://sass-lang.com/guide
#2
1
In Codepen, change your preprocessor from Sass to SCSS.
在Codepen中,将预处理器从Sass更改为SCSS。
See this for more info on the difference between Sass and SCSS: What's the difference between SCSS and Sass?
有关Sass和SCSS之间差异的更多信息,请参阅此内容:SCSS和Sass之间的区别是什么?