Skip to content

Instantly share code, notes, and snippets.

@imlinus
Last active December 29, 2015 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save imlinus/7599009 to your computer and use it in GitHub Desktop.
Save imlinus/7599009 to your computer and use it in GitHub Desktop.
position mixin
@mixin position(
$position: absolute,
$top: null,
$right: null,
$bottom: null,
$left: null
) {
position: $position;
top: $top;
right: $right;
bottom: $bottom;
left: $left;
}
// usage
// demo: http://codepen.io/liljalinus/pen/Esqhw
.box {
@include position(absolute, 50px, null, null, 50px);
width: 100px;
height: 100px;
background: red;
}
@AdamHjerpe
Copy link

Alternative usage, more semantic and almost negates the need for commenting :) @include position(absolute, $top: 0, $left: 1.5rem);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment