#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
5 min read
Question 4 of 49medium

What are CSS Position Values?

Understanding static, relative, absolute, fixed, and sticky positioning.

What You'll Learn

  • All position values
  • When to use each
  • Positioning context

Position Values

ValueBehavior
staticDefault, normal flow
relativeOffset from normal position
absoluteRemoved from flow, relative to positioned ancestor
fixedRelative to viewport
stickyHybrid of relative and fixed

Examples

styles.cssCSS
/* Relative - offset from normal position */
.relative {
  position: relative;
  top: 10px;
  left: 20px;
}

/* Absolute - relative to positioned parent */
.absolute {
  position: absolute;
  top: 0;
  right: 0;
}

/* Fixed - stays in place on scroll */
.fixed-header {
  position: fixed;
  top: 0;
  width: 100%;
}

/* Sticky - sticks when scrolled to */
.sticky-nav {
  position: sticky;
  top: 0;
}