【问题标题】:SCSS changes "hsl($hue, 26, 100)" to "white" [duplicate]SCSS 将“hsl($hue, 26, 100)”更改为“white”[重复]
【发布时间】:2015-08-20 23:10:40
【问题描述】:

编写@for 循环以生成一组不同背景颜色的类。 SASS 代码:

@for $i from 0 through 15 {
    $classslug: writ;
    $hue: $i * 35 % 256;

    .#{$classslug}#{$i} {
        background: hsl($hue, 26, 100);
    }
}

预期结果:

.writ0 {
  background: hsl(0, 26, 100);
}

.writ1 {
  background: hsl(35, 26, 100);
}

.writ2 {
  background: hsl(70, 26, 100);
}

// etc.

编译的实际结果:

.writ0 {
  background: white;
}

.writ1 {
  background: white;
}

.writ2 {
  background: white;
}

// etc.

如何获得我期望的代码?由 Visual Studio 2013 中的 Web Essentials v5(?) 编译。

【问题讨论】:

  • 类似,但绝对不是重复的。引用的问题询问 Sass 更改代码的原因。我特地问了如何得到我期待的代码。

标签: css sass


【解决方案1】:

不要将hsl()的亮度参数(第三个)设置为100。使用一些接近但小于 100 的值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-14
    • 2015-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多