Using absolute position

I am using absolute position for div to put it under another div (full). But for some reason it impacts the whole body. You can see from the screenshot as well that it relates to body2. How can I change it? On the same page I have used the same approach and it has worked.


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

1 Like

Hi there,

When working with absolute positioning, it’s important to understand how the positioning context works. An absolutely positioned element will be positioned relative to its nearest positioned ancestor. By default, this is the viewport/document body if no parent elements have their position property set.

To contain an absolutely positioned element within a specific parent container, set the parent’s position property to either relative, absolute, or fixed. This establishes what’s called a “positioning context,” making the absolutely positioned child element reference this parent container instead of the document body.

For example:

.parent {
    position: relative;
}
.child {
    position: absolute;
    top: 0;
    left: 0;
}

Hopefully this helps! If you still need assistance, please reply here so somebody from the community can help.

1 Like