Difference between relative, absolute, fixed, and sticky positioning?

  • relative → positioned relative to normal flow.
  • absolute → positioned relative to its parent container.
  • fixed → fixed to viewport (doesn’t move on scroll).
  • sticky → behaves like relative, but sticks when scrolling.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *