I'm studying CSS and as I learn, when an absolute element A inside relative element B, that A will be relative to B. I want to test the case absolute element inside absolute element but I don't see any differences.
Here is my test:
<div id="box-1">
<div id="box-2"></div>
</div>
Absolute inside Relative
#box-1 {
width: 200px;
height: 200px;
background: #000000;
position: relative;
}
#box-2 {
width: 100px;
height: 100px;
left: 50px;
top: 50px;
background: #e2e2e2;
position: absolute;
}
Absolute inside Absolute
#box-1 {
width: 200px;
height: 200px;
background: #000000;
position: absolute;
}
#box-2 {
width: 100px;
height: 100px;
left: 50px;
top: 50px;
background: #e2e2e2;
position: absolute;
}
So. my question is: Are there any differences when an absolute element is inside other absolute element ? If not, why every examples that I have read always just mention the case absolute element inside other relative element ?
thanks :)