I'm using bootstrap 4 with sass(scss file
), and want to apply .mx-2
class properties into a new class. theorytically some thing like:
.MyCustomClass{
@extend .mx-2;
}
But apparently, compiler cannot find .mx-2
selector and it fails.
I know that mx-2
class created by using mixture of $size
, $length
, $spacers
,$breakpoint
etc...
So i changed it:
.MyCustomClass{
margin-left: ($spacer * .5) !important;
margin-right: ($spacer * .5) !important;
}
I'm wondering to know:
- If there is a better, neater way to do that?
- If i can replace
.5
with some variable? - What if i want to extend another sizing class like:
.mx-lg-2
?