Last active
June 24, 2017 11:53
-
-
Save Swimburger/a82ba4a631728b5dfec7cf6295b9a74f to your computer and use it in GitHub Desktop.
Generate margin utility classes. Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.21) | |
// Compass (v1.0.3) | |
// ---- | |
@mixin margin-class($side, $number) { | |
$firstLetter: str-slice($side, 0, 1); | |
.m-#{$firstLetter}-#{$number}{ | |
margin-#{$side}: #{$number}px; | |
} | |
} | |
@mixin generate-margin(){ | |
$margins: (15, 30, 50); | |
$sides: ("top", "right", "bottom", "left"); | |
@each $margin in $margins{ | |
@each $side in $sides{ | |
@include margin-class($side, $margin); | |
} | |
} | |
} | |
@include generate-margin(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.m-t-15 { | |
margin-top: 15px; | |
} | |
.m-r-15 { | |
margin-right: 15px; | |
} | |
.m-b-15 { | |
margin-bottom: 15px; | |
} | |
.m-l-15 { | |
margin-left: 15px; | |
} | |
.m-t-30 { | |
margin-top: 30px; | |
} | |
.m-r-30 { | |
margin-right: 30px; | |
} | |
.m-b-30 { | |
margin-bottom: 30px; | |
} | |
.m-l-30 { | |
margin-left: 30px; | |
} | |
.m-t-50 { | |
margin-top: 50px; | |
} | |
.m-r-50 { | |
margin-right: 50px; | |
} | |
.m-b-50 { | |
margin-bottom: 50px; | |
} | |
.m-l-50 { | |
margin-left: 50px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment