Sobes.tech
Middle+

What are the possible values of the CSS property position?

sobes.tech AI

Answer from AI

The CSS property position determines how an element is positioned on the page. Main values:

  • static — default value, the element is positioned in the normal document flow.
  • relative — the element is positioned relative to its normal position, and can be offset using top, left, etc.
  • absolute — the element is positioned relative to the nearest positioned ancestor (not static), or relative to the viewport if none exists; it is taken out of the normal flow.
  • fixed — the element is fixed relative to the browser window and does not move when scrolling.
  • sticky — the element behaves like relative until it reaches a specified position during scrolling, then it behaves like fixed.

Example:

.element {
  position: absolute;
  top: 10px;
  left: 20px;
}