Files
Andrei Calinescu bf255ddb05 Added SASS solutions, fixed typos, code formatting (#34792)
* Added SASS solution and output CSS

* Fixed typo, added code formatting

The example code outputs for "start to end" and "start through end" were swapped. "1 to 3" does not include the end number, so should output "1 2", while "1 through 3" includes the end number, so should output "1 2 3"

* Added SASS solution and output CSS

* Added SASS solution

* Updated solution to full solution

Now includes all seed code, plus the changes needed to pass the tests, per @thecodingaviator [suggestion](https://github.com/freeCodeCamp/freeCodeCamp/pull/34792#pullrequestreview-210097979).

* Updated solution to full solution

Now includes all seed code, plus the changes needed to pass the tests, per @thecodingaviator suggestion https://github.com/freeCodeCamp/freeCodeCamp/pull/34792#pullrequestreview-210097979.

* Fixed Markdown syntax

Minor edit

* Updated solution to full solution

Now includes all seed code, plus the changes needed to pass the tests, per @thecodingaviator suggestion https://github.com/freeCodeCamp/freeCodeCamp/pull/34792#discussion_r263731937.
2019-03-08 21:07:52 +05:30

577 B

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

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

Solution

<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>