Streaming live at 10am (PST)

Why is position:Absolute parent object always Body?


#1

When I set a Div inside another Div to position:Absolute, the parent object is always Body, although the Body is not actually the parent of the Div.

Also, the interface sort of indicates that the parent can be changed, but nothing happens when pressing the Body link beside the target icon?


#2

The position of the parent element that you want to function as the parent needs to be set to Relative. That target icon is only showing you what the current parent is.

body
parent position:relative;
child position:absolute;
content
/child
/parent
/body


#3

Actually I now see that if the object with position:Absolute is placed inside a column block, the parent (the column block) do not have to be sat to position:Relative, it can be Auto/Static. But if a div is the parent object, it has to be set to position:Relative. I think this has confused me a bit.


#4

The rule is: an element is position:absolute regarding of its closest positioned parent.

So we use position:relative without any other value to just declare a parent element as the reference.


#5

This topic was automatically closed after 60 days. New replies are no longer allowed.