DEV Community

Vishnu Priya S
Vishnu Priya S

Posted on

Day 3 of Payilagam

Position property in CSS defines how an element is placed on a web page. (top, bottom, left, and right)
5 types of position

  1. static- default behaviour offsets(top/left) do not work.

  2. relative- It owns the original position and move your position where it used to be.

  3. absolute- It checks the parent class if it is non- static it works accordingly.

  4. fixed- An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. (eg: E-commerce website of header, footer)

  5. sticky- behaves like normal element until the user reach the specific point. It sticks and acts like it is fixed(only within its parent container).

Top comments (0)