Can you change the parent when position is absolute?

Hi!

When I change the object’s position to absolute it’s always relative to body. Can I change it being relative to some other object?

Samu

Hi Samu,

An absolute element is relative to its container.

In order to have a better control, you should wrap a Div block around it (that will act as the parent element) and the absolute block inside will then be positioned relatively to the parent element.

Additional info: CSS position property

Hope this makes sense :slight_smile:

2 Likes

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