Sass 为什么我能';t在变量中添加零填充
我想知道为什么不能在SCSS中的变量右侧添加两个零 示例代码:Sass 为什么我能';t在变量中添加零填充,sass,Sass,我想知道为什么不能在SCSS中的变量右侧添加两个零 示例代码: @for $i from 1 through 4 { .animated--#{$i}00 { -webkit-animation-duration: #{$i}00ms; animation-duration: #{$i}00ms; -webkit-animation-fill-mode: both; animation-fill-mode: both; } } 正在印刷 .animate
@for $i from 1 through 4 {
.animated--#{$i}00 {
-webkit-animation-duration: #{$i}00ms;
animation-duration: #{$i}00ms;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
}
正在印刷
.animated--10 {
-webkit-animation-duration: 10ms;
animation-duration: 10ms;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated--20 {
-webkit-animation-duration: 20ms;
animation-duration: 20ms;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated--30 {
-webkit-animation-duration: 30ms;
animation-duration: 30ms;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.animated--40 {
-webkit-animation-duration: 40ms;
animation-duration: 40ms;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
我已经通过以下方式解决了问题(由同事建议):
我想知道为什么在SCSS变量的右侧添加一个右填充零会呈现上述示例。我认为这是您的编译器提供的,当我在SassMester上尝试您的代码时,这两个零正确打印。这很奇怪,因为这里()给出的结果与我发布的结果相同
@for $i from 1 through 4 {
.animated--#{$i * 100} {
-webkit-animation-duration: #{$i * 100}ms;
animation-duration: #{$i * 100}ms;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
}