<div class="modal">
<div class="modal__body">
<h2 class="modal__title">Modal Title</h2>
<button class="modal__close-button">x</button>
</div>
</div>
<header>
<h1 class="header__title">Labzindex</h1>
<button class="header__call-to-action">call us</button>
</header>
<div class="posts-wraper">
<div class="posts">
<article class="posts__item">Post 1</article>
<article class="posts__item">Post 2</article>
<article class="posts__item">Post 3</article>
<article class="posts__item">Post 4</article>
</div>
</div>
$zindex-flow: 100;
$zindex-modal-backdrop: 1040;
$zindex-modal: 1060;
html {
--red: #bc442f;
--green: #007b7d;
--green: #007b7d;
--yellow: #ffc978;
}
body {
background: var(--yellow);
}
h1 {
margin: 0;
color: var(--yellow);
}
body,
html {
padding: 0;
margin: 0;
}
header {
background: var(--red);
padding: 16px;
text-align: center;
display: flex;
align-items: center;
justify-content: space-around;
h1 {
color: var(--yellow);
}
}
.header__call-to-action {
z-index: 2;
border: none;
text-transform: uppercase;
padding: 12px;
border-radius: 4px;
color: #f2f2f6;
font-weight: bold;
background: var(--green);
}
.modal {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
background: hsla(0, 0%, 0%, 0.42);
}
.modal__body {
position: relative;
color: var(--yellow);
background: var(--green);
height: 90%;
max-width: 500px;
flex: 1;
margin: 0 auto;
padding: 16px;
box-sizing: border-box;
}
.modal__close-button {
position: absolute;
top: -20px;
right: -20px;
width: 50px;
border: none;
height: 50px;
font-size: 24px;
border-radius: 100%;
}
.modal__title {
font-size: calc(36 / 16 * 1rem);
margin: 0;
top: 0;
left: 16px;
}
.posts {
display: grid;
max-width: 600px;
grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
gap: 20px;
margin: 30px auto;
position: relative;
z-index: 1;
&__item {
background: white;
font-size: calc(24 / 16 * 1rem);
height: 150px;
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
}
}
.modal {
z-index: $zindex-modal-backdrop;
}
.modal__body {
z-index: $zindex-modal;
}
header {
z-index: $zindex-flow;
}
.header__call-to-action {
z-index: $zindex-flow;
}
.posts-wraper {
z-index: $zindex-flow;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.