-
-
Save rebotak/7d02bcc2ff9c1cfc2433d800e920b70d to your computer and use it in GitHub Desktop.
padding and margin bootstrap based helpers
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
$positions: ( | |
t: ('top'), | |
r: ('right'), | |
b: ('bottom'), | |
l: ('left'), | |
x: ('left', 'right'), | |
y: ('top', 'bottom') | |
); | |
@mixin sizeValue($prop, $i) { | |
#{$prop}: ($i * .5em); | |
}; | |
@for $i from 0 to 6 { | |
@each $prop, $propValue in (m: 'margin', p: 'padding') { | |
.#{$prop}-#{$i} { | |
@include sizeValue((#{$propValue}), $i); | |
} | |
@each $var, $value in $positions { | |
.#{$prop}#{$var}-#{$i} { | |
@each $pos in $value { | |
@include sizeValue((#{$propValue}-#{$pos}), $i); | |
} | |
} | |
@if ($i == 0 and $prop == 'm') { | |
.m#{$var}-auto { | |
@each $pos in $value { | |
margin-#{$pos}: auto; | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment