gpt4 book ai didi

css - SCSS 具有 rgba() 格式的颜色,但颜色是十六进制格式。如何在生成的 css 中保持 RGBA() 格式的颜色?

转载 作者:太空宇宙 更新时间:2023-11-03 21:34:21 25 4
gpt4 key购买 nike

我有一个 SCSS 文件,这里是它的一部分。SCSS:

$red: 200;
$green: 200;
$blue: 200;
$opa: 1;
.th-layout-class{
background-color: rgba($red, $green, $blue, $opa);
padding: 10px;
border-right: 1px solid grey;
border-bottom: 1px solid grey;
border-collapse: collapse;
}

CSS:

.th-layout-class, th:nth-child(3) {
background-color: #c8c8c8;
padding: 10px;
border-right: 1px solid grey;
border-bottom: 1px solid grey;
border-collapse: collapse; }

显然,#c8c8c8 是 rgba(200,200,200)。但是如何在 rgba() 格式中使用#c8c8c8,以便应用不透明度?

谢谢。

最佳答案

因为不透明度为1,所以相当于没有任何不透明度的十六进制格式。

如其所说here :

In compressed output mode, Sass will output the smallest CSS representation of a color. For example, #FF0000 will output as red in compressed mode, but blanchedalmond will output as #FFEBCD.

如果您使用不同的不透明度,它将被强制使用 rgba() 格式。

关于css - SCSS 具有 rgba() 格式的颜色,但颜色是十六进制格式。如何在生成的 css 中保持 RGBA() 格式的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27597371/

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