Last active
March 27, 2019 22:35
-
-
Save JonathanWThom/a505326e8112f93b25984eeedce92abf to your computer and use it in GitHub Desktop.
Generating margin and padding helpers with SASS
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
$styles: margin padding; | |
$directions: left right top bottom; | |
@each $style in $styles { | |
@for $i from 0 through 50 { | |
.#{$style}-#{$i} { #{$style}: #{$i}px; } | |
@each $direction in $directions { | |
.#{$style}-#{$direction}-#{$i} { #{$style}-#{$direction}: #{$i}px } | |
} | |
} | |
} | |
// Creates: | |
// .margin-1, .margin-left-1, .margin-right-1, .margin-top-1, .margin-bottom-1 from 1px up to 50px | |
// .padding-1, .padding-left-1, .padding-right-1, .padding-top-1, .padding-bottom-1 from 1px up to 50px |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment