Created
August 3, 2016 17:20
-
-
Save peteroid/d28f994e6da15d3e2f96d43c79ed4666 to your computer and use it in GitHub Desktop.
An example implementing the vertical alignment
This file contains 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
/* absolution position + transform approach */ | |
.parent { | |
height: 100vh; | |
position: relative; | |
.children { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
} | |
} | |
/* display table approach, working for min height on parent */ | |
.parent { | |
display: table; | |
min-height: 100vh; | |
.children { | |
display: table-cell; | |
vertical-align: middle; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment