Skip to content

Instantly share code, notes, and snippets.

@htdangkhoa
Created December 10, 2024 07:21
Show Gist options
  • Save htdangkhoa/c2f1460c01d5e3691cac4fc5ef50a407 to your computer and use it in GitHub Desktop.
Save htdangkhoa/c2f1460c01d5e3691cac4fc5ef50a407 to your computer and use it in GitHub Desktop.
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
text-align: left;
z-index: 1000;
pointer-events: none;
}
.modal-dialog {
pointer-events: all;
width: auto;
max-width: 500px;
margin-left: auto;
margin-right: auto;
margin-top: 1.75rem;
margin-bottom: 1.75rem;
}
.modal-backdrop {
background: rgba(0,0,0, .5);
}
.modal.show + .modal-backdrop {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
cursor: pointer;
}
.modal.fade .modal-dialog {
transition: transform .3s ease-out;
transform: translate(0, -50px);
}
.modal.show .modal-dialog {
transform: none;
}
.modal-content {
display: flex;
flex-direction: column;
background: white;
border-radius: .5rem;
}
.modal-header {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: space-between;
padding: 1rem;
border-top-left-radius: calc(.5rem - 1px);
border-top-right-radius: calc(.5rem - 1px);
}
.modal-body {
position: relative;
flex: 1 1 auto;
padding: 1rem;
}
.modal-footer {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: flex-end;
gap: .5rem;
padding: calc(1rem - .5rem * .5);
border-bottom-left-radius: calc(.5rem - 1px);
border-bottom-right-radius: calc(.5rem - 1px);
}
@media screen and (max-width: 768px) {
.modal-dialog {
width: 90%;
height: 90%;
box-sizing: border-box;
}
}
.fade:not(.show) {
opacity: 0;
}
.fade {
transition: opacity .15s linear;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment