Use @for to Create a Sass Loop - Bug?

Use @for to Create a Sass Loop - Bug?
0.0 0

#1

Tell us what’s happening:

Hi guys,

had a look around but it seems like there’s no fixed solution for this problem. I had a look at the console and my code seems to work as intended (so creating the desired effect as specified by the challenge)… but obviously it’s not accepting it. I tried formatting the text with different whitespace and carriage returns but to no avail.

Any ideas ?

Your code so far


<style type='text/sass'>
  
  @for $j from 1 to 6 {
    .text-#{$j} {
    font-size:10px*$j
    }
  }
  
</style>

<p class="text-1">Hello</p>
<p class="text-2">Hello</p>
<p class="text-3">Hello</p>
<p class="text-4">Hello</p>
<p class="text-5">Hello</p>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/sass/use-for-to-create-a-sass-loop/


#2

You code is okay.

Possible issue: your browser comes with a minimum and maximum font-size that out of the range challenge expected.

Similar issue, please check following thread


#3

I was just about the make the same post - I thought I was going crazy…

 @for $j from 1 to 6 {
    .text-#{$j} { font-size: 10px * $j; }
  }

#4

I though so too, but I’ve tried multiple different browsers, all with the same result (even Edge, and it just hangs without running the code !). I also checked that post but no luck :frowning:, thanks anyway !


#5

That makes two of us :smiley: !


#6

That’s expected :rofl:

The exact code from you worked for me, I’m on chrome.

Maybe your browser comes with 3rd party extension may fail the test?! what about run the chrome in safe-mode and try again?


#7

@NULL_dev - That’s a good call.

I’ve just gone incognito in my chrome - And it’s worked fine… Clearly an extension having some effect


#8

I’ve tried on a different machine, Chrome and Firefox, incognito mode on both but nothing. This is really starting to bug me now :confused:

Ignore that. Lo and behold, this morning it decided to work with incognito mode on Chrome (had the same problem on a following challenge “Sass: Apply a Style Until a Condition is Met with @while”, sorted that out too).

Thank you very much guys :slight_smile: !


#9

Maybe your chrome works better during the morning :smile:

That’s more evil, since chrome comes with minimum font-size of 6px, so you will never have a 5px. I tried with FF, but it needs luck (when FCC test starts after SASS completes)

Keep going on great work, happy coding.


#10

Oh no, that worked like a charm too. Don’t know why, don’t know how, but as long as the code is correct, in this case, I’m happy :smiley: !

Thank you very much for your help !