Position relative why use?

Asked

Viewed 31 times

0

Why use the position:relative?

If the absolute does everything in the matter of positioning, why not use only the position:absolute instead of using both?

  • 2
  • 2

    position: relative makes child elements with Absolute fit (top, left, bottom and right) to the parent element instead of adjusting the whole page. That is, if an element with position:Bsolute is inside an element with position:relative, the top:0 and left:0 position will be based on the parent element, if this parent element is in the middle of the page then the position will be from this location, instead of the end of the page. In short, relative is not the same thing as Absolute and we usually use both together.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.