CSS Positioning Properties


  The position property in CSS determines how an element is positioned in the document flow.


Types of Positioning


The common values for the position property in CSS are:

position: static; - Normal position in the flow.
position: relative; - Positioned relative to its original position.
position: absolute; - Positioned in relation to its positioned container.
position: fixed; - Positioned relative to the window.
position: sticky; - Acts as relative until sticky is triggered.


Purpose


Using positioning properties allows you to:


  • Control the exact location of elements on the page.
  • Create complex layouts with precision.
  • Apply advanced and custom visual effects.


Exercises



The rest of the content is available only for registered and premium users!



Which 'position' value is used to keep an element fixed relative to the browser window?