Use @if and @else to Add Logic To Your Styles 5

Tell us what’s happening:
I am so confused on this one. What am I doing wrong on this one? I tried to find a forum on this, but couldn’t find any forum on it. I’m wondering what I’m doing wrong to get the last two errors, which I do not understand at all.

Your code so far


<style type='text/sass'>
  
  @mixin border-stroke($val) {
    @if $val == light {
      border: 1px solid black;
    }
    @else if $val == medium {
      border: 3px solid black;
    }
    @else if $val == heavy {
      border: 6px solid black;
    @else {
      border: none
    }
  
  #box {
    width: 150px;
    height: 150px;
    background-color: red;
    @include border-stroke(medium);
  }  
</style>

<div id="box"></div>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36 Avast/73.0.1258.87.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/sass/use-if-and-else-to-add-logic-to-your-styles/

There are two problems with your code.

  1. The heavy condition doesn’t have a closing curly brace.
  2. Your border: none doesn’t have a semicolon.
1 Like