I always hear that the main difference between relative and absolute that absolute can be placed out of its parent boundary!
if I can do same thing absolute does using relative, so what is the advantage of using absolute over relative>
An example
<style>
* {
margin: 0;
padding: 0;
}
.first_div {
width:300px;
height:300px;
background-color:red;
margin: 50px auto;
}
.second_div {
width:140px;
height:140px;
background-color:green;
position: relative;
top: 50px;
right: 80px;
}
</style>
<div class="first_div">
<div class="second_div"></div>
</div>
as you see I can place the green square anywhere in the page using relative same as absolute does
So what's the main advantage of using absolute over relative ?