Skip to content

Position

Position utilities control CSS positioning and provide a set of named placement classes for anchoring elements within a positioned container. Combine them with inset utilities to offset elements from their edges, and with z-index utilities to manage stacking order.

ClassSets
.p-absoluteposition: absolute
.p-fixedposition: fixed
.p-relativeposition: relative
.p-stickyposition: sticky

Placement classes position an element within its nearest positioned ancestor. They work with all position types.

ClassPosition
.at-centerDead center of the container
.at-golden-ratioVertically at the golden ratio (~38.2% from top), horizontally centered
.at-maximumStretches to fill the entire container (100dvw × 100dvh)
.at-topTop edge, horizontally centered
.at-rightRight edge, vertically centered
.at-bottomBottom edge, horizontally centered
.at-leftLeft edge, vertically centered
.at-top-leftTop-left corner
.at-top-rightTop-right corner
.at-bottom-leftBottom-left corner
.at-bottom-rightBottom-right corner
.at-center
.at-golden-ratio
.at-maximum
.at-bottom
.at-top
.at-left
.at-right
.at-top-right
.at-bottom-right
.at-bottom-left
.at-top-left

Inset utilities set the offset distance between a positioned element and the edges of its container. They set the --tng-inset custom property, which is consumed by the placement classes above.

ClassSets
.inset-none--tng-inset: var(--tng-spacing-none)
.inset-3xs--tng-inset: var(--tng-spacing-3xs)
.inset-2xs--tng-inset: var(--tng-spacing-2xs)
.inset-xs--tng-inset: var(--tng-spacing-xs)
.inset-sm--tng-inset: var(--tng-spacing-sm)
.inset-md--tng-inset: var(--tng-spacing-md)
.inset-lg--tng-inset: var(--tng-spacing-lg)
.inset-xl--tng-inset: var(--tng-spacing-xl)
.inset-2xl--tng-inset: var(--tng-spacing-2xl)
Continues up to .inset-10xl

Inset values use the same spacing tokens as padding and gap, keeping distances consistent across the system.

.inset-none
.inset-3xs
.inset-2xs
.inset-xs
.inset-sm
.inset-md
.inset-lg
.inset-xl
.inset-2xl
.inset-3xl
.inset-4xl
.inset-5xl
.inset-6xl
.inset-7xl
.inset-8xl
.inset-9xl
.inset-10xl
<!-- Badge in the top-right corner with a small inset -->
<div class="p-relative">
<img src="product.jpg" alt="Product" />
<span class="tng-badge | p-absolute at-top-right inset-sm">New</span>
</div>
PatternClasses
Overlay centered in viewport.p-fixed .at-center .z-overlay
Badge on an image corner.p-absolute .at-top-right .inset-sm
Sticky header.p-sticky .at-top .z-sticky
Full-screen backdrop.p-fixed .at-maximum .z-overlay
Golden-ratio dialog.p-fixed .at-golden-ratio .z-overlay
  • Always set a positioning context.p-absolute needs a parent with .p-relative (or another positioned ancestor). Without one, the element positions relative to the viewport.
  • Combine with z-index — positioned elements often overlap others. Use z-index utilities to control stacking.
  • Prefer placement classes over raw CSS.at-top-right .inset-sm is more readable and maintainable than hand-written top / right / translate combinations.