Update _mixins.scss

This commit is contained in:
Pedro Reis 2017-03-30 15:18:58 +01:00 committed by GitHub
parent a266914c3c
commit 967014e0ba
1 changed files with 23 additions and 0 deletions

View File

@ -58,3 +58,26 @@
clear: both; clear: both;
} }
} }
/**
* Positioning
*/
@mixin center($horizontal: true, $vertical: true) {
position: absolute;
@if ($horizontal and $vertical) {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@else if ($horizontal) {
left: 50%;
transform: translate(-50%, 0);
}
@else if ($vertical) {
top: 50%;
transform: translate(0, -50%);
}
}