Skip to content

Instantly share code, notes, and snippets.

@jacobdubail
Created June 12, 2014 20:53
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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