I'm trying to achieve a layout where I have a div with position: relative, and inside it, I want to place another div with position: absolute. However, I want only the part of the absolute div that is outside the relative div to be visible, while the part inside the relative div should be hidden. How can I accomplish this effect using CSS? Any help would be appreciated!
.relative-container {
position: relative;
width: 200px;
height: 200px;
background-color: red;
z-index: 2;
}
.absolute-element {
position: absolute;
bottom: -10px;
right: -10px;
z-index: 1;
width: 100px;
height: 100px;
background-color: blue;
}
<div class="relative-container">
<div class="absolute-element"></div>
</div>