Tell us what’s happening:
i wrote this code and it works on the simulator window but shows errors in the output window under the editor.
Your code so far
<style type='text/sass'>
$x : 1;
@while $x <11 {
.text-#{$x} { font-size: #{5*$x}px;}
$x : $x + 1;
}
</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>
<p class="text-6">Hello</p>
<p class="text-7">Hello</p>
<p class="text-8">Hello</p>
<p class="text-9">Hello</p>
<p class="text-10">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.87 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while
1 Like
This could be becasue you have set a minimum font size for your browser.
Check your browser config, it has a section about minimum font size, probably it’s something like 8px, so this 5px will be ignored, and test fails.
Example in chrome:
Go to menu -> settings -> search for and goto “Customize fonts” -> adjust the minimum font size to something like 4px and try again the test. Later you would rollback this setting of course.
1 Like
It’s 100% buggy exercise. Seems to accept/reject randomly . This code got accepted in one go. But when I submitted it again (almost immediately afterwards), it didn’t pass through.
<style type='text/sass'>
$x: 1;
@while $x < 11 {
.text-#{$x} { font-size: 5px * $x;}
$x: $x + 1;
}
</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>
<p class="text-6">Hello</p>
<p class="text-7">Hello</p>
<p class="text-8">Hello</p>
<p class="text-9">Hello</p>
<p class="text-10">Hello</p>
Used FireFox.
My SASS code
$x: 1;
@while $x < 11 {
.text-#{$x} { font-size: 5px * $x;}
$x: $x + 1;
}
But my code is not passing for text-1
I used Chrome
this solves my issue. My chrome has minimal fonts set to 6 and it failed for .text-1
Thanks for this trick!