Static positioning is the default positioning model for elements. They appear on the page where they appear as part of a normal HTML stream. Statically positioned elements do not obey the rules left , top , right and bottom :

Relative positioning allows you to specify a specific offset ( left , top , etc.) that refers to the normal position of the element in the HTML stream. Therefore, if I have a text box inside a div , I could apply relative positioning in the text box so that it appears in a specific place relative to where it usually fits in the div :

There is also absolute positioning - in this case you indicate the exact location of the element relative to the entire document, or the next relatively positioned element further down the tree of elements :

And when a position: relative is applied to the parent in the hierarchy:

Please note that our position element is absolutely associated with a relatively positioning element.
And finally fixed. Fixed positioning restricts an element to a certain position in the viewport, which remains in place during scrolling:

You can also observe that elements with fixed positions do not cause scrolling, since they are not considered to be associated with the viewport:

While absolutely positioned elements are still connected by the viewport and will cause scrolling:

.. unless, of course, your parent uses overflow: ? to determine the scroll behavior (if any).
With absolute positioning and fixed positioning, elements are inferred from the HTML stream.
Matthew Abbott Feb 16 2018-11-11T00: 00Z
source share