Last active
October 2, 2017 08:49
-
-
Save signsi/a4d56857b3e5e15b0ed05636ce6ca99b to your computer and use it in GitHub Desktop.
[Vertical Centering] #css #layout
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
position: relative; | |
margin-top: 50%; | |
transform: translateY(-50%); | |
/* Mixin --> not tested */ | |
@mixin vertical-align($position: relative) { | |
position: $position; | |
top: 50%; | |
-webkit-transform: translateY(-50%); | |
-ms-transform: translateY(-50%); | |
transform: translateY(-50%); | |
} | |
.element p { | |
@include vertical-align(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment