Use @if and @else to Add Logic To Your Styles {can't find my mistake}

Use @if and @else to Add Logic To Your Styles {can't find my mistake}
0

#1

Tell us what’s happening:
Can’t seem tp phatom what’s wrong with my code that’s inhibiting me from progressing.

Your code so far


<style type='text/sass'>
  
  @mixin border-stroke ($val) {

   @if $val == light {
    border-stroke: 1px solid black;
   }
   @else if $val == medium {
    border-stroke: 3px solid black;
   }
   @else if $val == heavy {
    border-stroke: 6px solid black;
    }    
   @else $val == none {
    border-stroke: no border;
    }
  }

  #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; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0.

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


#2

first else $val == none cannot work without if, second the no border is confusing. if you have some lint or go to w3 you find out the parameter is just none.


#3

@mixin border-stroke($val){
@if $val == light{
border-stroke:1px solid black;
}
@else if $val == medium {
border:3px solid black;
}
@else if $val == heavy{
border:6px solid black;
}
@else {
border:none;
}
}

Hope it is helpful for U