Create Reusable CSS with Mixins SASS

Tell us what’s happening:

I don’t understand this part

Your code so far


<style type='text/scss'>

#awesome{
@include border-radius mixin(15px);
}


@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}

#awesome {
  width: 150px;
  height: 150px;
  background-color: green;
}
</style>

<div id="awesome"></div>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0.

Challenge: Create Reusable CSS with Mixins

Link to the challenge:

There is a nice way you can learn sass. Copy all the html and scss over to codepen.io, once you set that up, click on the :gear: icon and select view compiled css.

The :gear: can be found right besides the CSS name for the section.

For this first time, I set it up for you.


As for a conceptual explanation. mixins are pieces of code you define and call anywhere you want, somethine like this:


@mixin mymix(args){}

.class1{
@include mymix(args)
}

.class2{
@include mymix (args)
}

Where args are optional.