Skip to content

Instantly share code, notes, and snippets.

@wadackel
Created November 8, 2016 07:44
Show Gist options
  • Save wadackel/25bbd00648dd8cdca7ded242a376fc02 to your computer and use it in GitHub Desktop.
Save wadackel/25bbd00648dd8cdca7ded242a376fc02 to your computer and use it in GitHub Desktop.
Mixin for positioning API.
@mixin position($type, $top: null, $right: null, $bottom: null, $left: null, $z-index: null) {
position: $type;
top: $top;
right: $right;
bottom: $bottom;
left: $left;
z-index: $z-index;
}
@mixin fixed($args...) {
@include position(fixed, $args...);
}
@mixin absolute($args...) {
@include position(absolute, $args...);
}
@mixin relative($args...) {
@include position(relative, $args...);
}
@mixin static() {
@include position(static, null, null, null, null, null);
}
//== Usage
.hoge {
@include absolute(null, null, 50px, 10px, 100);
}
// .hoge {
// position: absolute;
// bottom: 50px;
// left: 10px;
// z-index: 100;
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment