In class we learned that if I have two divs: a wrapper div (let's call it div A
) that's defined as position: relative;
and another div, div B
that's inside div A
with position: absolute;
.
What will happen is that now the position of div B
is dependent on the position of div A
. Meaning that now the point 0,0 of div B
is not the point 0,0 of the browser, but of div A
. So, if I was to move div A
say 20 pixels to the right, and div B
30 pixels to the right, div B
would be 50 pixels to the right of the browser's point 0,0;
Now, my question is: what if I have 3 divs. Div A that's position: relative;
, within it div B
that's position: absolute
, and within div B
, another div (div C
) with position: absolute;
. Now, how will div C behave? Will its position 0,0 be that of div A
or div B
?
Thanks in advance.
code:
<style type = "text/css">
#a {
position: relative;
left: 20px;
}
#b {
position:absolute;
left: 20px
}
#c {
left: 20px
position:absolute;
}
</style>
<div id = "a">
<div id = "b">
<div id = "c">
test
</div>
</div>
</div>