Skip to main content

Tailwind CSS Positioning

Complete Tailwind v4 positioning reference.
Position, inset, float, overflow, and more.

Position Types

static
static

Default position (normal flow)

relative
rel

Positioned relative to normal position

absolute
abs

Positioned relative to nearest positioned ancestor

fixed
fixed

Fixed to viewport (stays on scroll)

sticky
sticky

Sticky until scroll threshold

Inset Scale (top, right, bottom, left)

inset-0
0px
inset-0.5
2px
inset-1
4px
inset-1.5
6px
inset-2
8px
inset-2.5
10px
inset-3
12px
inset-3.5
14px
inset-4
16px
inset-5
20px
inset-6
24px
inset-7
28px
inset-8
32px
inset-9
36px
inset-10
40px
inset-11
44px
inset-12
48px
inset-14
56px
inset-16
64px
inset-20
80px
inset-24
96px
inset-28
112px
inset-32
128px
inset-36
144px
inset-40
160px
inset-44
176px
inset-48
192px
inset-52
208px
inset-56
224px
inset-60
240px
inset-64
256px
inset-72
288px
inset-80
320px
inset-96
384px
inset-px
1px
inset-auto
auto
inset-full
100%
inset-1/2
50%

Inset Utilities

All Sides

inset-*All 4 sides
inset-x-*Left & right
inset-y-*Top & bottom

Individual Sides

top-* right-* bottom-* left-*Physical
start-* end-*Logical inline
inset-s-* inset-e-*Logical inline (alias)

Common Patterns

Fill Parent

inset-0
<div class="absolute inset-0">
  <!-- Stretches to fill parent -->
</div>

Top-Left Corner

TL
<div class="absolute top-2 left-2">
  <!-- Top-left positioned -->
</div>

Bottom-Right Corner

BR
<div class="absolute bottom-2 right-2">
  <!-- Bottom-right positioned -->
</div>

Center (Transform)

C
<div class="absolute top-1/2 left-1/2
     -translate-x-1/2 -translate-y-1/2">
</div>

Full Width (Top)

inset-x-0
<div class="absolute top-0 inset-x-0">
  <!-- Full width at top -->
</div>

Full Height (Left)

y-0
<div class="absolute left-0 inset-y-0">
  <!-- Full height on left -->
</div>

Real-World Examples

Fixed Header

<header class="fixed top-0 inset-x-0">
  <!-- Stays at top of viewport -->
</header>

Modal Overlay

<div class="fixed inset-0 bg-black/50">
  <!-- Full-screen backdrop -->
</div>

Floating Action Button

<button class="fixed bottom-4 right-4">
  <!-- FAB in corner -->
</button>

Sticky Sidebar

<aside class="sticky top-4">
  <!-- Sticks when scrolling -->
</aside>

Float & Clear

Float

float-leftfloat: left
float-rightfloat: right
float-startfloat: inline-start
float-endfloat: inline-end
float-nonefloat: none

Clear

clear-leftclear: left
clear-rightclear: right
clear-bothclear: both
clear-noneclear: none

Overflow

Both Axes

overflow-autoScroll if needed
overflow-hiddenClip content
overflow-clipClip (no scroll)
overflow-visibleNo clipping
overflow-scrollAlways scroll

Single Axis

overflow-x-autoHorizontal scroll
overflow-y-autoVertical scroll
overflow-x-hiddenClip horizontal
overflow-y-hiddenClip vertical

Object Fit & Position

Object Fit

object-containScale to fit
object-coverScale to fill (crop)
object-fillStretch to fill
object-noneNo resizing
object-scale-downSmaller of contain/none

Object Position

object-centercenter
object-toptop
object-bottombottom
object-leftleft
object-rightright
object-left-topleft top

Isolation

isolateisolation: isolate
isolation-autoisolation: auto

Use isolate to create a new stacking context, preventing elements from blending with elements outside the container.

Z-Index

Control stacking order with z-* utilities:

z-0z-10z-20z-30z-40z-50z-auto

For negative z-index, use -z-10. For arbitrary values: z-[100]