I have read so many question related to what I am asking but none of them answered/explained the question in my question's context. So what is happening is I have two divs a parent(.outer) and a child(.inner) div, and I am applying position: relative
to parent and position: absolute
to child, also I am adding a height of 1200px to child div, but the parent div is not taking up the full height as that of child div, I know a lot of question like has been answered on SO, but I want some explanation about why position: absolute on child element is causing or stopping the parent to take up the height to contain its child. Removing position absolute do let parent div to take the whole height to contain it's child div but I don't need tricks, but the explanation to why is position: absolute is causing the problem, What exactly position absolute is doing in this context, Here's my code snippet for the same,
.outer{
width: 100%;
min-height: 400px;
background-color: hotpink;
position: relative;
}
.inner{
position: absolute;
background-color: palegreen;
width: 30%;
height: 1200px;
top: 20%;
left: 20%;
}
<div class="outer">
<div class="inner">
</div>
</div>