Blog

CSS Position: Mastering Element Placement on Web Pages

Written by Pawan Sharma | Aug 2, 2024 1:30:00 PM

The position property in CSS is used to set the positioning method for an element. There are several values that can be assigned to the position property, each of which affects how the element is positioned within its containing element or relative to other elements. Here are the most common values.

  1. Static Position
  2. Relative Position
  3. Absolute Position
  4. Fixed Position
  5. Sticky Position

1. Static Position

Static is the default value for the position property in CSS. When an element is positioned statically, it follows the normal flow of the document. In this positioning method, the top, right, bottom, and left properties do not have any effect on the element.

  • Elements are positioned according to the normal flow of the document.
  • The top, right, bottom, and left properties are ignored.
  • This is the default positioning method applied to all elements.

HTML Example :