Skip to content

Instantly share code, notes, and snippets.

@jacobdubail
Created June 12, 2014 20:53
Show Gist options
  • Save jacobdubail/87152f705171080fe329 to your computer and use it in GitHub Desktop.
Save jacobdubail/87152f705171080fe329 to your computer and use it in GitHub Desktop.
@mixin center-align($dir: false) {
$map: (
top: ( Y ),
left: ( X )
);
@if map_get($map, $dir) != null {
#{$dir}: 50%;
transform: #{"translate#{map_get($map,$dir)}(-50%)"};
} @else {
transform: translate(-50%,-50%);
top: 50%;
left: 50%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment