从左上角到右下角的css中的渐变背景颜色

时间:2018-01-21 14:45:47

标签: css css3 sass background

我在网页上工作,我想给它一个带渐变的背景颜色。从紫色到浅色。

但是,css无效。如果有人能让我知道我错过了什么,为什么不工作?

背景颜色与此codepen中的背景颜色相同。 https://codepen.io/alexboffey/pen/NAkQLE?limit=all&page=2&q=calculator 这里开发人员使用了scss。 这是css

$purp: #542437;
$gold: #CDB380;

body {
    margin: 0 auto;
    height: 100vh;
    display: flex;
    background: linear-gradient(to bottom right, $purp 0%, $gold 100%) 100% no-repeat;
}

2 个答案:

答案 0 :(得分:1)

如果你把十六进制代替$ purp和$ gold就可以了。这可能是一个没有正确编译的问题吗?

body {
    margin: 0 auto;
    height: 100vh;
    display: flex;
    background: linear-gradient(to bottom right, #542437 0%, #CDB380 100%) 100% no-repeat;
}
<body>

</body>

答案 1 :(得分:0)

因此,在SCSS在本地环境中工作之前,您需要做很多工作:https://medium.com/@ricardozea/sass-for-beginners-the-friendliest-guide-about-how-to-install-use-sass-on-windows-22ff4a32c1f7。另外,我相信你必须用.scss扩展名保存CSS文件。 这是一个使用直接十六进制颜色代码#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> int main(void) { unsigned int i, n, sum = 0, N, a = 1, j; char num[100], x[2] = { 0 }; printf("Determining an armstrong number\n\n" "Enter a number: "); fflush(stdin); gets(num); n = strlen(num); for (i = 0; i < n; i++) { a = 1; x[0] = num[i]; N = atoi(x); /* for (j = 1; j <= n; j++) a *= N; */ sum += pow(N, n); } n = atoi(num); if (sum == n) printf("\nIt is an Armstrong number!\n"); else printf("\nIt is not an Armstrong number!\n"); return 0; } #542437的小提琴,万一有人好奇:https://jsfiddle.net/ss20wh3f/2/

相关问题