CSS position property

CSS position

CSS position is used to specify the method for positioning the element.

Each value allows different ways to position the element, in the window.

CSS position property values are

  • static : It is the default value. Elements will be positioned in the order as they were entered in the document.
  • relative : Element will be positioned relative to its normal position.
  • absolute : Element is created in the page layout with no space. Element will be positioned relative to its first positioned element.
  • fixed : Element is created in the page layout with no space. Element is positioned relative to the browser window
  • sticky : Element will be positioned according to the user's scrolling position.

Example

Try Yourself