Added Solution in Guide to while sass problem (#35172)
* Guide: added solution @while sass Added proper Solution to the Guide for the problem Apply a Style Until a Condition is Met with @while, this is no longer a stub * fix: used 2-space indentation and removed verbiage * Removed images with broken links * Added back the images previously removed.
This commit is contained in:
committed by
Randell Dawson
parent
1bcf65dd05
commit
c9a4c901d4
@ -1,10 +1,68 @@
|
|||||||
---
|
---
|
||||||
title: Apply a Style Until a Condition is Met with @while
|
title: Apply a Style Until a Condition is Met with @while
|
||||||
---
|
---
|
||||||
|
|
||||||
## Apply a Style Until a Condition is Met with @while
|
## Apply a Style Until a Condition is Met with @while
|
||||||
|
|
||||||
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/front-end-libraries/sass/apply-a-style-until-a-condition-is-met-with-while/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
|

|
||||||
|
|
||||||
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
|
 Remember to use <a>**`Read-Search-Ask`**</a> if you get stuck. Try to pair program  and write your own code 
|
||||||
|
|
||||||
|
### Problem Explanation:
|
||||||
|
|
||||||
|
This program is very simple, the trick is to remember how while looping works.
|
||||||
|
|
||||||
|
##  Hint: 0
|
||||||
|
|
||||||
|
* **Make sure your zoom settings are at `100%` or `default` otherwise tests sometimes fail. **
|
||||||
|
|
||||||
|
##  Hint: 1
|
||||||
|
|
||||||
|
* You will initialise the loop first with x as: `$x: 1`
|
||||||
|
|
||||||
|
> _try to solve the problem now_
|
||||||
|
|
||||||
|
##  Hint: 2
|
||||||
|
|
||||||
|
* See the example for `@while` syntax, `@while $x < 11`
|
||||||
|
|
||||||
|
> _try to solve the problem now_
|
||||||
|
|
||||||
|
##  Hint: 3
|
||||||
|
|
||||||
|
* to set class properties inside a loop we reference them enclosed by #{}, hence ere it will become: `.text-#{$x}`
|
||||||
|
|
||||||
|
> _try to solve the problem now_
|
||||||
|
|
||||||
|
## Spoiler Alert!
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
**Solution ahead!**
|
||||||
|
|
||||||
|
##  Basic Code Solution:
|
||||||
|
|
||||||
|
|
||||||
|
```css
|
||||||
|
$x: 1;
|
||||||
|
@while $x < 11 {
|
||||||
|
.text-#{$x} {
|
||||||
|
font-size: 5px * $x;
|
||||||
|
}
|
||||||
|
$x: $x + 1;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Relevant Links
|
||||||
|
|
||||||
|
* <a href='https://sass-lang.com/documentation/file.SASS_REFERENCE.html#interpolation_' target='_blank' rel='nofollow'>Interpolation</a>
|
||||||
|
* <a href='https://sass-lang.com/documentation/file.SASS_REFERENCE.html#variables_' target='_blank' rel='nofollow'>Variables</a>
|
||||||
|
* <a href='https://sass-lang.com/documentation/file.SASS_REFERENCE.html#while' target='_blank' rel='nofollow'>while loops</a>
|
||||||
|
|
||||||
|
##  NOTES FOR CONTRIBUTIONS:
|
||||||
|
|
||||||
|
*  **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution.
|
||||||
|
* Add an explanation of your solution.
|
||||||
|
* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. 
|
||||||
|
|
||||||
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
|
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
|
||||||
|
Reference in New Issue
Block a user