Position
Tailwind CSS Position
Use responsive position utilities with TW elements. A tutorial on how to control the position of elements.
Statically positioning elements
Use .static
class 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.
Static parent
Absolute child
Relatively positioning elements
Use .relative
class that allows the element to be positioned
relative to its normal position in the document flow.
Any offsets are calculated relative to the element’s normal position and the element will act as a position reference for absolutely positioned children.
Relative parent
Absolute child
Absolutely positioning elements
In order to position an element outside of the regular flow of a document
and have its neighboring elements behave as if the element is not present,
one can make use of .absolute
class.
With static positioning
Relative parent
Static parent
Static child
Static sibling
With absolute positioning
Relative parent
Static parent
Absolute child
Static sibling
Fixed positioning elements
To create an element with a fixed position in Tailwind, you can use the
.fixed
class. The fixed class positions the element relative
to the viewport, which means it will stay in the same position even if the
user scrolls the page.
Contacts
Corey Anderson
Ray Flint
John Smith
Maria Samantha
Mindy Albrect
Lisa Cudrow
Emily Williams
Sticky positioning elements
Use .sticky
class to position an element as relative until it
crosses a specified threshold, then treat it as fixed until its parent is
off screen.
Any offsets are calculated relative to the element’s normal position and the element will act as a position reference for absolutely positioned children.
A
Abigail Davis
Alexander Lee
Amelia Collins
Andrew Carter
B
Benjamin Hughes
Bradley Wood
Brianna White
Brittany Campbell
C
Caleb Adams
Catherine James
Charlotte Gray
Corey Bailey