Use @each to Map Over Items in a List - issue passing tests?

Tell us what’s happening:
The output appears to be correct and the code is working as requested. Only 1/4 tests are passing?

passed - Your code should use the @each directive.
Your .blue-bg class should have a background-color of blue.
Your .black-bg class should have a background-color of black.
Your .red-bg class should have a background-color of red.

Your code so far


<style type='text/sass'>


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

@each $key, $color in $colors {
  .#{$color}-bg {background-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 (Macintosh; Intel Mac OS X 10_13_4) 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

1 Like

Hey, @jgburton! I copied and pasted your code and it worked and tests passed.

Strange. Maybe copy your code, refresh the page, and paste it. Then run your tests again.