Last active
June 21, 2017 22:17
-
-
Save amadrzyk/fc21013002e180f08cb128c5c98f360f to your computer and use it in GitHub Desktop.
How to Vertically Align a Div
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Vertical Align</title> | |
| <style> | |
| html, body { | |
| width: 100%; | |
| height: 100%; | |
| overflow: hidden; | |
| } | |
| .container { | |
| width: 100%; | |
| height: 100%; | |
| } | |
| .center-row { | |
| width: 100%; | |
| height: 100%; | |
| display: table; | |
| margin: 0; | |
| } | |
| .center-col { | |
| width: 100%; | |
| text-align: center; | |
| display: table-cell; | |
| vertical-align: middle; | |
| float: none; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <div class="row center-row"> | |
| <div class="col-xs-4 center-col"> | |
| <p> hello </p> | |
| </div> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment