Last active
November 10, 2022 08:27
-
-
Save sjns19/e06cc5d97ab1c8b25d6ef7cc8e78c393 to your computer and use it in GitHub Desktop.
Demo CSS file for Modal system tutorial article at Medium
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 { | |
position: fixed; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
width: 100%; | |
height: 100%; | |
top: 0; | |
left: 0; | |
z-index: 1; | |
opacity: 0; | |
pointer-events: none; | |
transition: opacity 0.2s; | |
} | |
.modal::before { | |
position: absolute; | |
content: ''; | |
background-color: rgba(0, 0, 0, 0.15); | |
height: inherit; | |
width: inherit; | |
} | |
.modal-visible .modal { | |
opacity: 1; | |
pointer-events: all; | |
} | |
.modal-visible .modal-contents { | |
transform: scale(1); | |
} | |
.modal-contents { | |
background-color: #fff; | |
color: #000; | |
padding: 0.75rem; | |
width: 400px; | |
z-index: 2; | |
text-align: center; | |
box-shadow: 0 0 35px 0 rgba(0, 0, 0, 0.2); | |
transform: scale(0.8); | |
transition: transform 0.2s; | |
} | |
.modal-header, | |
.modal-body { | |
padding: 0.75rem; | |
} | |
.modal-footer { | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
padding: 0.75rem; | |
} | |
.modal-btn { | |
padding: 0.55rem 1.25rem; | |
margin: 0 0.55rem; | |
border: none; | |
outline: none; | |
cursor: pointer; | |
} | |
.modal-btn:hover { | |
opacity: 0.5; | |
} | |
.modal-confirm { | |
background-color: teal; | |
color: #fff; | |
} | |
.modal-cancel { | |
background-color: #efefef; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment