<div class="absolute-element"></div>
<div class="parent">
<div class="absolute-element2"></div>
</div>
<!-- Read the full article and tutorial on webexpe.com -->
.absolute-element {
position: absolute;
top: 50px;
left: 50px;
width: 50px;
height: 50px;
background: blue;
}
.absolute-element2 {
position: absolute;
top: 50px;
left: 100px;
width: 50px;
height: 50px;
background: yellow;
}
.parent {
/* position: relative; */
background: orangered;
width: 200px;
height: 200px;
margin-top: 150px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.