modal dialog
body {
margin: 0;
min-height: 200vh; /* force scrolling */
}
header {
background-color: #f57352;
}
.header-body {
padding: 1em 0;
margin: 0 auto;
width: 80%;
}
/* modal dialog */
.modal {
display: none; /* ⭐️ hide initially */
position: fixed; /* ⭐️ fixed */
inset: 0; /* ⭐️ obscure entire <body> */
/* ⭐️ semi-transparent */
background-color: rgba(0, 0, 0, 0.5);
}
.modal-body {
position: fixed; /* ⭐️ fixed */
inset: 3em 20%;
width: 180px; /* ⭐️ override `right` */
padding: 2em;
background-color: #eee;
overflow: auto; /* ⭐️ scrollable */
}
/* buttons */
button {
background-color: black;
color: white;
padding: .4em 1em;
border-radius: 6px;
}
button:hover {
background-color: #666;
}📗 CSS in Depth, p.179
👉 position (CSS)
Last updated
Was this helpful?