Created
April 25, 2016 02:16
-
-
Save jayaregalinada/a9302c08b1ed0c5a73160536d8390a32 to your computer and use it in GitHub Desktop.
Sass Mixin for Margins
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
@mixin margin($size, $position: false) { | |
@if $position == false { | |
margin: $size !important; | |
} | |
@else { | |
margin-#{$position}: $size !important; | |
} | |
} | |
.no-margin { | |
@include margin(0); | |
} | |
@each $position in top, right, bottom, left { | |
.no-margin-#{$position} { | |
@include margin(0, $position); | |
} | |
.margin-#{$position}-#{auto} { | |
@include margin(auto, $position); | |
} | |
@for $i from 1 through 50 { | |
@if $i % 10 == 0 { | |
.margin-#{$position}-#{$i} { | |
@include margin($i * 1px, $position); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment