Absolute - An absolute element is positioned relative to the nearest parent element. In case a parent element is not present it is positioned based on the page itself and moves along with the page scroll.
Relative - When an object is positioned relative to an element without adding any position attributes nothing happens. However, if a positional attribute is placed Eg: 20px to the right, the element will move 20px to the right of the original element.
Fixed - A fixed position implies that the element remains fixed to the viewport, which means it stays in the same place even if the page is scrolled.
Static - Elements are positioned static by default, these elements are not affected by positional attributes (Top, bottom, left, right). If an element is positioned static it follows the normal flow of the page.
: Commonly asked Front-End developer interview questions