SASS - Use @if and @else to Add Logic To Your Styles

Tell us what’s happening:
Describe your issue in detail here.
how to create a mixin
Your code so far

<style type='text/scss'>
light - 1px solid black
medium - 3px solid black
heavy - 6px solid blacklight - 1px solid black
medium - 3px solid black
heavy - 6px solid black


  #box {
    width: 150px;
    height: 150px;
    background-color: red;
    @include border-stroke(medium);
  }
</style>
@mixin: border-stroke(medium);
<div id="box"></div>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Challenge: SASS - Use @if and @else to Add Logic To Your Styles

Link to the challenge:

Just look at the example given to you:


@mixin text-effect($val) {
  @if $val == danger {
    color: red;
  }
  @else if $val == alert {
    color: yellow;
  }
  @else if $val == success {
    color: green;
  }
  @else {
    color: black;
  }
}

More about them here

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.