top
Sets the top offset of a positioned element. Only works with position set to relative, absolute, fixed, or sticky.
Class Patterns
t{N}{unit} format. Use neg-t{N}{unit} for negative values.
| Class | CSS | Description |
|---|---|---|
t0 | top: 0 | Stick to top |
t8px | top: 8px | 8px below top |
t16px | top: 16px | 16px below top |
t2rem | top: 2rem | 20px below top |
t5rem | top: 5rem | 50px below top |
t50p | top: 50% | 50% of parent height below |
t100p | top: 100% | Positioned at parent bottom |
ta | top: auto | Default (auto) |
neg-t2rem | top: -2rem | 20px above top |
neg-t8px | top: -8px | 8px above top |
Visual Comparison
See how elements move based on top values within a positioned parent.
Top offset comparison for absolute elements
t0 sticks to top, larger values move further down
Negative top — extends above
neg-t2rem extends 20px above parent top
Class Details
t{N}{unit}top: {value}
Sets the distance from the top reference point. Supports px, rem, % units.
<!-- sticky Header -->
<nav class="ps t0 w100p zi10 bg0F0F17 py12px px2rem">
Fixed Navigation
</nav>
<!-- Absolute positioning -->
<div class="pr h20rem">
<div class="pa t0 l0">Top left</div>
<div class="pa t0 r0">Top right</div>
<div class="pa t50p l50p">Center (transform needed)</div>
</div>
<!-- Dropdown menu (positioned below parent) -->
<div class="pr">
<button>Menu</button>
<ul class="pa t100p l0 mt4px bg18181B br8px p16px">
<li>Item 1</li>
<li>Item 2</li>
</ul>
</div>tatop: auto
Resets top to default (auto). Useful for releasing top positioning at specific breakpoints.
<!-- Responsive: release top on mobile -->
<div class="pa t2rem sm-ta sm-pr">
absolute on desktop + top: 2rem
On mobile: relative + top: auto
</div>neg-t{N}{unit}top: -{value}
Sets a negative top value. Moves elements above parent top.
<!-- Badge protruding above parent -->
<div class="pr mt2rem bg18181B p2rem br8px">
<span class="pa neg-t8px r8px bg6366F1 cFFFFFF py4px px8px br4px fs12px">NEW</span>
Card Content
</div>
<!-- Overlapping layout -->
<div class="pr">
<div class="bg27272A p2rem br8px">Default area</div>
<div class="pr neg-t2rem ml2rem bg6366F1 cFFFFFF p16px br8px">
Overlapping area above
</div>
</div>Tips & Notes
position required
top does not work with position: static (default). Use with pr, pa, pf, or ps.
Sticky header pattern
ps t0 is the most common sticky header pattern. Sticks to top when scrolling.
% unit based on parent height
t50p moves down by 50% of parent height. May behave unexpectedly without explicit parent height.