I am a little confused about absolute positioning right now. I have always thought that if I position an element absolutely it would be positioned relative to it's parent element (in contrast to relative to it's usual position like relative positioning). During homework I now came across this situation and I'm confused:
<body>
<div> <!-- This is colored red in my example -->
...
</div>
<div style="position: absolute;"> <!-- This is colored green in my example -->
...
</div>
</body>
What I would expect: What I got:
Of course when I set an actual position with left
/right
/top
/bottom
I get what I would expect from an absolutely positioned element. So is position: absolute
just set to take the exact position it would be at without position: absolute
when not specified otherwise?