Last active
November 15, 2019 14:51
-
-
Save wheresrhys/5822860 to your computer and use it in GitHub Desktop.
Vertical and horizontally centered overlay using just css (flexbox)
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
.overlay-mask { | |
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */ | |
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */ | |
display: -ms-flexbox; /* TWEENER - IE 10 */ | |
display: -webkit-flex; | |
display: flex; | |
-webkit-box-align: center; | |
-webkit-flex-align: center; | |
-ms-flex-align: center; | |
-webkit-align-items: center; | |
align-items: center; | |
-webkit-box-pack: center; | |
-moz-box-pack: center; | |
-ms-flex-pack: center; | |
-webkit-justify-content: center; | |
justify-content: center; | |
-webkit-box-orient: vertical; | |
-moz-box-orient: vertical; | |
-webkit-box-direction: normal; | |
-moz-box-direction: normal; | |
-webkit-flex-direction: column; | |
-ms-flex-direction: column; | |
flex-direction: column; | |
position:fixed; | |
height: 100%; | |
width: 100%; | |
top: 0; | |
z-index: 999; | |
background-color: rgba(0, 0, 0, 0.5); | |
padding: 6px; | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; | |
} | |
.overlay-content { | |
padding: 5px; | |
min-height: 10px; | |
min-width: 10px; | |
margin-top: 100px; | |
margin: auto; | |
background-color: #fff; | |
-webkit-border-radius: 12px; | |
-moz-border-radius: 12px; | |
border-radius: 12px; | |
border: 1px solid #a5a5a5; | |
position: relative; | |
-webkit-align-self: center; | |
align-self: center; | |
-webkit-align-content: center; | |
align-content: center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment