* fix: restructure certifications guide articles * fix: added 3 dashes line before prob expl * fix: added 3 dashes line before hints * fix: added 3 dashes line before solutions
41 lines
655 B
Markdown
41 lines
655 B
Markdown
---
|
|
title: Use @if and @else to Add Logic To Your Styles
|
|
---
|
|
# Use @if and @else to Add Logic To Your Styles
|
|
|
|
|
|
---
|
|
## Solutions
|
|
|
|
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
|
|
|
```scss
|
|
<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>
|
|
|
|
</details>
|
|
```
|