Last active
August 29, 2015 14:11
-
-
Save jofralogo/df0a1e4db94012dd620a to your computer and use it in GitHub Desktop.
Mixins for easy vertical and horizontal center alignment with SCSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin vertical-align { | |
position: relative; | |
top: 50%; | |
-webkit-transform: translateY(-50%); | |
-ms-transform: translateY(-50%); | |
transform: translateY(-50%); | |
} | |
@mixin horizontal-align { | |
position: relative; | |
left: 50%; | |
-webkit-transform: translateX(-50%); | |
-ms-transform: translateX(-50%); | |
transform: translateX(-50%); | |
} | |
.vcenter{ | |
@include vertical-align; | |
} | |
.hcenter{ | |
@include horizontal-align; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment