Skip to content

Position

Utilities for controlling the positioning of elements in your application.

ClassProperties
position-staticposition: static;
position-relativeposition: relative;
position-absoluteposition: absolute;
position-fixedposition: fixed;
position-stickyposition: sticky;
top-0top: 0;
right-0right: 0;
bottom-0bottom: 0;
left-0left: 0;

Usage

The position utilities allow you to quickly style the positioning of any element. These classes can be used to apply the position and top, right, bottom, and left properties to an element.

Static

The default position value for all elements is static. This means that the element is positioned according to the normal flow of the document. The top, right, bottom, left properties have no effect on a statically positioned element.

Relative

The position-relative class allows you to position an element relative to its normal position in the document. This means that the top, right, bottom, and left properties can be used to move the element from its normal position.

Absolute

The position-absolute class allows you to position an element relative to its closest positioned ancestor. If no positioned ancestor is found, the element is positioned relative to the document body.

Fixed

The position-fixed class allows you to position an element relative to the viewport. This means that the element will stay in the same position even when the page is scrolled.

Sticky

The position-sticky class allows you to position an element based on the user's scroll position. The element is treated as relative until it crosses a specified threshold, at which point it is treated as fixed.

Released under the MIT License.