Skip to content

Position

Position and inset utilities for controlling element placement. Included in @grundtone/design-tokens CSS — see Installation for setup.

All utilities support responsive prefixes: sm:, md:, lg:, xl:, 2xl:.


Position values

Control element positioning with short class names:

.absolute .top-0 .end-0
.absolute .bottom-0 .start-0
parent is .relative
ClassCSS
.staticposition: static
.relativeposition: relative
.absoluteposition: absolute
.fixedposition: fixed
.stickyposition: sticky

Inset

Pin elements to edges of their positioned parent. Inline directions (start/end) use logical properties for RTL support:

.absolute .inset-0 — fills entire parent
ClassCSSDescription
.inset-0inset: 0All edges
.inset-x-0inset-inline: 0Left + right (RTL-aware)
.inset-y-0inset-block: 0Top + bottom
.top-0top: 0Top edge
.bottom-0bottom: 0Bottom edge
.start-0inset-inline-start: 0Start (left in LTR)
.end-0inset-inline-end: 0End (right in LTR)

Create a header that stays visible while scrolling, layered above content with z-index:

.sticky .top-0 .z-sticky — scroll down ↓
Item 1
Item 2
Item 3
Item 4
Item 5
Item 6
Item 7
Item 8
html
<header class="sticky top-0 z-sticky">Navigation</header>

Position shortcuts

Pre-composed classes for common fixed/sticky patterns. Z-index values use CSS custom properties from the z-index token system:

ClassPositionEdgesZ-index
.fixed-topfixedtop: 0 + inset-inline: 0var(--z-fixed)
.fixed-bottomfixedbottom: 0 + inset-inline: 0var(--z-fixed)
.sticky-topstickytop: 0var(--z-sticky)

Responsive

Change position at different breakpoints:

html
<!-- Static on mobile, sticky from md -->
<nav class="static md:sticky md:top-0 md:z-sticky">...</nav>

<!-- Absolute on mobile, fixed from lg -->
<div class="absolute lg:fixed lg:inset-x-0 lg:bottom-0">...</div>

Comparison with Bootstrap

FeatureBootstrap 5Grundtone
Position naming.position-relative.relative
Inset utilities.top-0, .start-0Same + .inset-0, .inset-x-0
RTL support.start-0 / .end-0Same (logical properties)
!importantOn every utilityNone
Responsive.position-md-sticky.md:sticky
Shortcuts z-indexHardcoded valuesCSS custom properties