Position
Class reference
Static
Use .static
to position an element according to the normal flow of the document.
Any offsets will be ignored and the element will not act as a position reference for absolutely positioned children.
`}
Relative
Use .relative
to position an element according to the normal flow of the document.
Offsets are calculated relative to the element's normal position and the element will act as a position reference for absolutely positioned children.
`}
Absolute
Use .absolute
to position an element outside of the normal flow of the document, causing neighboring elements to act as if the element doesn't exist.
Offsets are calculated relative to the nearest parent that has a position other than static
, and the element will act as a position reference for other absolutely positioned children.
`}
Fixed
Use .fixed
to position an element relative to the browser window.
Offsets are calculated relative to the viewport and the element will act as a position reference for absolutely positioned children.
`}
Sticky
Note that sticky positioning is not supported in IE11.
Use .sticky
to position an element as relative
until it crosses a specified threshold, then treat it as fixed until its parent is off screen.
Offsets are calculated relative to the element's normal position and the element will act as a position reference for absolutely positioned children.
<div>
<div className="sticky top-0 ...">Sticky Heading 1</div>
<p className="py-4">Quisque cursus...</p>
</div>
<div>
<div className="sticky top-0 ...">Sticky Heading 2</div>
<p className="py-4">Integer lacinia...</p>
</div>
<div>
<div className="sticky top-0 ...">Sticky Heading 3</div>
<p className="py-4">Nullam mauris...</p>
</div>
<!-- etc. -->
Responsive
To change how an element is positioned only at a specific breakpoint, add a {screen}:
prefix to any existing position utility. For example, adding the class md:absolute
to an element would apply the absolute
utility at medium screen sizes and above.
For more information about Tailwind's responsive design features, check out the Responsive Design documentation.
all
sm
md
lg
xl
null
Customizing
@include('_partials.variants-and-disabling', [ 'utility' => [ 'name' => 'position', 'property' => 'position', ], 'variants' => [ 'responsive', ], ])