static - All HTML elements are positioned static
by default, meaning they are positioned with the flow of the page.
relative - In order to use any other postition
property different than static
the parent element needs to have position: relative;
, so that it's children can be positioned against it via properties top
, bottom
, left
, right
.
fixed - Element gets positioned relative to the viewport.
absolute - Element is positioned relative to the nearest positioned ancestor (anyone except static
ones), else uses the document body if no other non static
ancestor is available.
sticky - Element is positioned based on the user's scroll position, toggles between relative
and fixed
.