.wrapper { width: 100%; height: 100vh; background-color: silver; } .first { width: 100%; height: 50%; background-color: #282b3a; } .second { width: 100%; height: 100%; background-color: #eeeeee; } .block { top: -40px; position: relative; width: 200px; height: 200px; background-color: #fff; margin: 0 auto; box-shadow: 3px 8px 15px #b3afaf, -3px 8px 15px #b3afaf; } <div class="wrapper"> <div class="first"> </div> <div class="second"> <div class="block"> </div> </div> </div> It is necessary to remove the shadow at the top of the sidelines, where the block comes to another. Whatever the overlap of the upper block was, there was no shadow, but below it. For clarity, the screen, above the red lines, the shadow should be removed, leaving everything below.
