-
-
Save aaitken/3947851 to your computer and use it in GitHub Desktop.
vertical align content
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> | |
| <link href="lightbox.css" media="all" rel="stylesheet" type="text/css" /> | |
| </head> | |
| <body> | |
| <div class="lightbox"> | |
| <div class="overlay"></div> | |
| <div class="wrapper"> | |
| <div class="inner"> | |
| <div class="content"> | |
| content sdlkfjsdlf lsdkfj sdlfks sldfkj <br>sdlfkj sdf lksdjf sdlfkjsd flsdkfj s<br> | |
| content sdlkfjsdlf lsdkfj sdlfks sldfkj <br>sdlfkj sdf lksdjf sdlfkjsd flsdkfj s | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |
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
| body { | |
| width: 100%; | |
| height: 100%; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .lightbox { | |
| position: fixed; | |
| width: 100%; | |
| height: 100%; | |
| text-align: center; | |
| } | |
| .lightbox .overlay { | |
| height: 100%; | |
| width: 100%; | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| z-index: 10; | |
| background-color: rgba(0,0,0,0.5); | |
| } | |
| .lightbox:before { | |
| content: ' '; | |
| height: 100%; | |
| background-color: blue; | |
| } | |
| .lightbox:before, | |
| .lightbox .wrapper { | |
| display: inline-block; | |
| text-align: left; | |
| vertical-align: middle; | |
| position: relative; | |
| z-index: 20; | |
| } | |
| .lightbox .wrapper { | |
| background-color: red; | |
| } | |
| .lightbox .inner { | |
| max-height: 500px; | |
| max-width: 500px; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment