简体   繁体   English

我的 SASS 循环使用插值和百分比中断

[英]My SASS loop is breaking using interpolation and percentage

This code is breaking my SASS process for some reason..由于某种原因,此代码正在破坏我的 SASS 进程。

@for $i from 1 through 100 {
  .t-#{$i} {
    top: #{$i}%;
  }
} 

You can change to this:你可以改成这样:

@for $i from 1 through 100 {
  .t-#{$i} {
    top: 1% * $i
  }
}

From SASS docs :来自SASS 文档

SASS

Here is an example这是一个例子

You can also write like this你也可以这样写

@for $i from 1 through 100 {
  .t-#{$i} {
    top: #{$i + '%'};
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM