I have a design with two stacked divs, and I'm trying to create the illusion that one is behind the other using shadow effects. When I add a shadow to the left side of the right div, it works perfectly. However, when I try to add a shadow to the right side of the left div, the shadow appears behind the right div instead of in front of it. Is there a solution to this issue?
.container{
display: grid;
width: fit-content;
height: 150px;
align-items: center;
grid-template-columns: 1fr auto;
border: solid 2px black;
margin-left: 15%;
}
.container:hover{
cursor: pointer;
}
.container:hover > .leftDiv{
height: 100%;
box-shadow: 4px 0px 15px -1px black;
}
.container:hover > .rightDiv{
height: 80%;
box-shadow: none;
}
.leftDiv{
width: 150px;
height: 80%;
background-color: red;
border: 2px red solid;
transition: 0.3s;
}
.rightDiv{
width: 100px;
height: 100%;
background-color: blue;
border: 2px blue solid;
transition: 0.3s;
box-shadow: -4px 0px 15px -1px #000000;
}
<div class="container">
<div class="leftDiv">
</div>
<div class="rightDiv">
</div>
</div>