我正在尝试使用文件中的$background-color变量为我的应用设置背景颜色variables.scss.当设置一个颜色时,这样可以正常工作,如#000或#fff,但不能使它适用于渐变.
$background-color: linear-gradient(to bottom, #000 0%, #fff 100%);
此代码抛出以下Sass错误:
argument '$color' of 'rgba($color, $alpha)' must be a color Backtrace.
那么,如何将背景颜色设置为渐变?
这是scss我用于自己的背景渐变的代码。
$SIDEMENU_TOP: #A23C4B;
$SIDEMENU_BOTTOM: #ff9068;
$SIDEMENU_TRANSPARENCY: rgba(255,255,255,0.4);
.side-menu-gradient{
background: -webkit-gradient(left top, $SIDEMENU_TOP, $SIDEMENU_BOTTOM);
background: -o-linear-gradient(bottom right, $SIDEMENU_TOP, $SIDEMENU_BOTTOM);
background: -moz-linear-gradient(bottom right, $SIDEMENU_TOP, $SIDEMENU_BOTTOM);
background: linear-gradient(to bottom right, $SIDEMENU_TOP, $SIDEMENU_BOTTOM);
}
Run Code Online (Sandbox Code Playgroud)
(可能深受Ionic Creator - 创建美丽的 Sidemenus (YouTube)的启发