Let's say I have a layout like this:
<body>
<main class="main">
<div class="aside-section">first</div>
<div class="section">second</div>
</main>
</body>
And css like this:
.main {
display: flex;
padding: 30px;
background: rgba(0, 0, 0, 0.8);
position: relative;
z-index: 10;
}
.aside-section {
width: 50%;
padding-left: 150px;
height: 90vh;
position: fixed;
background: green;
}
.section {
margin-left: 50%;
width: 50%;
height: 90vh;
background-color: yellow;
}
main
z-index is not working and aside-section
and section
appear on top of it. I want main
to be on top of all elements to make a modal mask. I can't figure out how to solve the issue and why it is happening in the first place. How can I fix it?