Custom modal z-index problem
by hartmaj2
HTML
<div class="overlay"> </div>
<div class="custom-modal-background">
<div class="custom-modal" >
<div class="modal-div">
<div class="highlighted">
I want to be in front of everything
</div>
</div>
</div>
</div>
<div class="highlighted">
I am in front of everything
</div>
<div>
I am not in front of everything
</div>
CSS
.custom-modal-background {
position: fixed;
display: flex;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
align-items: center;
justify-content: center;
z-index: 1500;
}
.custom-modal {
position: relative;
display: flex;
background-color: white;
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.5);
z-index: 2000;
}
.highlighted {
position: relative;
background-color: yellow;
z-index: 2100;
}