Last active
February 20, 2020 16:14
-
-
Save rizkysyazuli/5c1692362bf3aa75aad2 to your computer and use it in GitHub Desktop.
[SCSS - Positioning] #scss
This file contains hidden or 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 position($position, $args) { | |
@each $o in top right bottom left { | |
$i: index($args, $o); | |
@if $i and $i + 1 <= length($args) and type-of(nth($args, $i + 1)) == number { | |
#{$o}: nth($args, $i + 1); | |
} | |
} | |
position: $position; | |
} | |
@mixin absolute($args) { | |
@include position("absolute", $args); | |
} | |
@mixin fixed($args) { | |
@include position("fixed", $args); | |
} | |
@mixin relative($args) { | |
@include position("relative", $args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment