Use @each to Map Over Items in a List not working

Use @each to Map Over Items in a List not working
0

#1

Tell us what’s happening:

Your code so far


<style type='text/sass'>
  @each $color in blue, black, red {
    .#{$color}-bg {background-color: $color;}
  }
  @each $color in blue, black, red {
  .#{$color}-bg {color: $color;}
}

  div {
    height: 200px;
    width: 200px;
  }
</style>

<div class="blue-bg"></div>
<div class="black-bg"></div>
<div class="red-bg"></div>

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-each-to-map-over-items-in-a-list


#2

You have two each loops. Get rid of your 2nd loop.

Instead of hard coding colors. You should put them into a list like the example.

$colors: (color1: blue, color2: red, color3: green);

@each $key, $color in $colors {
.#{$color}-text {color: $color;}
}


#3

that another loop was just the trail and error from other posts as mine. But i just used the background-color one during execution. But anyway thanks for your time . I think its a bug from browser. I just wrote inline styles to just pass the test


#4

update : i dint use the sec @each loop during execution.