There are 4 states to the position property:

position: static;    /*(default)*/

Not affected by the top, bottom, left, and right properties.

position: relative;

Positioned relative to its normal position.
Setting the top, right, bottom, and left properties will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element.

position: fixed;

Positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. The top, right, bottom, and left properties are used to position the element.
Does not leave a gap in the page where it would normally have been located.

position: absolute;

Positioned relative to the nearest positioned ancestor (instead of positioned relative to the viewport, like fixed).
If there is no positioned ancestor, it uses the document body, and moves along with page scrolling.
Absolute positioned elements are removed from the normal flow, and can overlap elements.

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through resources like this. We hope you find it helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support here. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *