JS-Sass-@if AND @else

These are my Sass trials at FreeCodeCamp

@ If, @ else statement is the same as the logic in other programming languages.

<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;} /*If value doesn't come*/
}
#box {
width: 150px;
height: 150px;
background-color: red;
@include border-stroke(medium);/*We gave a value with @include*/
}
</style>

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



Comments

Popular posts from this blog

Tech Duos For Web Development

CIFAR-10 Dataset Classification Using Convolutional Neural Networks (CNNs) With PyTorch

Long-short-term-memory (LSTM) Word Prediction With PyTorch