As you can see their are two boxes, with one parent div and one sub div inside wrapper div. So i want to apply position absolute inside their relative parent div not to body.
/*--CSS--*/
.wrapper{
Height:80vh;
border:1px solid red;
}
.div_1{
Height:70vh;
border:1px solid blue;
margin:20px;
}
.sub_div{
Height:40vh;
border:1px solid green;
margin:20px;
}
.box{
height:100px;
width:100px;
background:orange;
position:absolute; /*Applied position absolute*/
}
.box1{
display:flex;
justify-content:center;
align-items:center;
top:0;
left:0;
}
.box2{
display:flex;
justify-content:center;
align-items:center;
bottom:0;
right:0;
}
<!--HTML-->
<div class="wrapper">
<div class="div_1">
<div class="box box1">
box1
</div>
<div class="sub_div">
<div class="box box2">
box2
</div>
</div>
</div>
</div>
So is their any way to achieve this.