0

When I take the child element out of the flow of the page by setting the position to absolute, I also need to set a position for the parent element, so I can position the child inside of the parent. However, I am unable to find an answer why should the parent position be relative or absolute? Does it matter for the child or is there a more of a big-picture reason to choose one over the other.

Or is it simply important to choose one or another simply to set the position, so the child can be manipulated.

P.S.

This is something that is not discussed in most tutorials for beginners, and I would like to learn it with understanding rather than leaving it unclear.

Many Thanks!

  • Tha's because if you dont have a relative parent, absolute child take the nearest relative parent or body if there are not any one. So if you want some element to move around all body, you can do it if you don't put relative position in any parent of it. – Carlos Eduardo Salazar Mori Mar 30 '21 at 19:55
  • *absolute child take the nearest relative parent* It's called *ancestor* then. – connexo Mar 30 '21 at 20:02

0 Answers0