SCSS/SASS helpers for padding & margin classes
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
$type: (p:padding, m:margin); | |
$position: (t:top, l:left, b:bottom, r:right); | |
$range: 0 5 10 15 20 25 30 35 40; | |
/* | |
* Loop and create classes that serve as quick padding/margin modifiers. | |
* Explanation of class syntax: | |
* | |
* ".p-t-0" Assign a padding-top of 0px (!important). | |
* ".m-b-35" Assign a margin-bottom of 35px (!important). | |
* | |
* Classes are generated for "p" (padding), "m" (margin), "t"/"l"/"b"/"r" (top/left/bottom/right), having a range of | |
* 0 to 40 (increments of 5). | |
*/ | |
@each $t, $t2 in $type { | |
@each $p, $p2 in $position { | |
@each $r in $range { | |
.#{$t}-#{$p}-#{$r} { | |
#{$t2}-#{$p2}: #{$r}px !important; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment