Position utilities control how an element is positioned relative to its normal flow, its nearest positioned ancestor, or the viewport. This lesson covers all five position values along with the offset utilities used alongside them.
What Are Position Utilities?
Tailwind's position utilities map to the CSS position property: static, relative, absolute, fixed, and sticky. They're almost always paired with offset utilities like top-0, right-4, or inset-0 to place the element precisely.
Positioning is foundational for overlays, badges, sticky headers, and modals, patterns you'll build repeatedly once you understand how relative and absolute work together.
relative establishes a positioning context for absolutely positioned children without moving itself.
absolute removes the element from normal flow and positions it relative to the nearest relative/absolute/fixed ancestor.
fixed positions relative to the browser viewport, staying in place while scrolling.
sticky behaves like relative until a scroll threshold, then sticks like fixed within its parent.
inset-0 is shorthand for top-0 right-0 bottom-0 left-0 applied together.
Position Utilities Cheatsheet
The five position values and the offset classes used to place elements.
Utility
CSS
Typical Use
static
position: static
Default flow, rarely written explicitly
relative
position: relative
Anchor for absolutely positioned children
absolute
position: absolute
Badges, tooltips, dropdown menus, overlays
fixed
position: fixed
Fixed headers, floating action buttons
sticky
position: sticky
Sticky table headers, sticky sidebars
inset-0
top/right/bottom/left: 0
Full-cover overlay inside a relative parent
top-4
top: 1rem
Offset from the top edge
-top-2
top: -0.5rem
Negative offset, moves element outward
inset-x-0
left/right: 0
Stretches horizontally within the parent
z-10
z-index: 10
Stacking order, covered in the Z-Index lesson
The relative + absolute Pairing
The most important positioning pattern in Tailwind is pairing a relative parent with one or more absolute children. The parent creates the coordinate system; the children are placed using top, right, bottom, left, or inset utilities relative to it.
fixed always positions relative to the viewport and stays visible regardless of scroll position or its parent's boundaries. sticky positions relative to its nearest scrolling ancestor and only "sticks" once its offset threshold is reached, then unsticks once its parent scrolls out of view.
The sticky header stays pinned to the top while its section scrolls, then scrolls away with the next section.
Building a Full-Screen Overlay
fixed inset-0 is the standard Tailwind pattern for a full-screen modal backdrop, since inset-0 stretches the element to all four edges of the viewport.
Using absolute without a positioned (relative, absolute, or fixed) ancestor, causing the element to position relative to the entire page instead.
Forgetting overflow-hidden on a relative parent when an absolutely positioned child should be clipped to its bounds.
Using fixed when sticky was actually the desired scrolling behavior, or vice versa.
Not setting a z-index on overlapping positioned elements, leading to unpredictable stacking order.
Applying sticky to an element whose parent has overflow: hidden or overflow: auto, which silently breaks sticky positioning.
Key Takeaways
Tailwind's position utilities map to the five CSS position values: static, relative, absolute, fixed, and sticky.
relative + absolute is the standard pairing for badges, tooltips, and overlays.
fixed positions relative to the viewport; sticky positions relative to the nearest scroll container.
inset-0 is shorthand for setting all four offset properties to zero at once.
Positioning issues are often caused by a missing relative ancestor or a parent with clipped overflow.
Pro Tip
If an absolutely positioned element isn't showing up where expected, check whether any ancestor has position: relative (or absolute/fixed); without one, it positions relative to the whole document.
You now understand Tailwind's position utilities. Next, learn how z-index utilities control stacking order between overlapping positioned elements.