1

So, I'm trying to learn SCSS and thought I'd try using a simple for loop to set transition-delays on a series of <li> elements.

I managed to get it to work, but I'm having a hard time combining the two strings I want. For example, this works fine:

li {
       @for $i from 1 through 8 
       {
           &:nth-of-type(#{$i}) 
           {
           transition-delay: #{$i}s;
           }
       }                            
  }

But, this gives me a transition delay of whole seconds. I want it to be (zero point seconds). Like 0.#{$i}s;

What am I missing? I've tried countless of variations and surely I'm just missing something really basic here? If I combine

KuKeC
  • 4,392
  • 5
  • 31
  • 60
Kenny Bones
  • 5,017
  • 36
  • 111
  • 174

1 Answers1

2

Please check my example or SassMeister Gist:

li {
  @for $i from 1 through 8 {
    &:nth-of-type(#{$i}) {
      transition-delay:  0.1s * $i;
    }
  }                            
}

Here's more on that matter: All You Ever Need to Know About Sass Interpolation

halfzebra
  • 6,771
  • 4
  • 32
  • 47