Last active
August 29, 2015 14:16
-
-
Save jasonbellamy/9024d9f7dbea10b2416f to your computer and use it in GitHub Desktop.
Modal overlay created using CSS fixed positioning.
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
<div class="modal"> | |
<div class="modal-content"> | |
modal content | |
</div> | |
<div class="modal-overlay"></div> | |
</div> |
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
.modal { | |
width: 100%; | |
height: 100%; | |
position: fixed; | |
} | |
.modal-content { | |
background: red; | |
color: rgb(255, 255, 255); | |
width: 25%; | |
padding: 1em; | |
position: relative; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
} | |
.modal-overlay { | |
background-color: rgba(0,0,0,0.5); | |
position: fixed; | |
top: 0; | |
left: 0; | |
bottom: 0; | |
right: 0; | |
z-index: -1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment