Position
Use these shorthand utilities for quickly configuring the position of an element.
Common values
Quick positioning classes are available, though they responsive.
.static
.relative
.absolute
.sticky
.fixed
Arrange Elements
Arrange elements easily with the edge positioning utilities. The format is {position}. has special utility class .all-0 to give full height/width to child element of parent element.
<div class="relative bg-highlight mb-7 h-50">
<div class="p-4 bg-dark rounded-sm absolute top-0 start-0"></div>
<div class="p-4 bg-dark rounded-sm absolute top-0 end-0"></div>
<div class="p-4 bg-dark rounded-sm absolute top-1/2 start-1/2"></div>
<div class="p-4 bg-dark rounded-sm absolute bottom-1/2 end-1/2"></div>
<div class="p-4 bg-dark rounded-sm absolute bottom-0 start-0"></div>
<div class="p-4 bg-dark rounded-sm absolute bottom-0 end-0"></div>
</div>
<div class="relative size-25" data-bs-theme="light">
<div class="bg-dark rounded-sm text-white flex flex-center absolute all-0">.all-0</div>
</div>
Center Elements
In addition, you can also center the elements with the transform utility classes .translate-middle, .translate-middle-x , .translate-middle-y. Responsive variations also exist for transform-middle, For example: transform-{2xl|xl|lg|md|sm}-middle-{x|y}.
<div class="relative bg-highlight h-50">
<div class="p-4 bg-dark rounded-sm absolute top-0 left-1/2 -translate-x-1/2" data-bs-theme="light"></div>
<div class="p-4 bg-dark rounded-sm absolute start-0 top-1/2 -translate-y-1/2" data-bs-theme="light"></div>
<div class="p-4 bg-dark rounded-sm absolute top-1/2 left-1/2 -translate-1/2" data-bs-theme="light"></div>
<div class="p-4 bg-dark rounded-sm absolute end-0 top-1/2 -translate-y-1/2" data-bs-theme="light"></div>
<div class="p-4 bg-dark rounded-sm absolute bottom-0 left-1/2 -translate-x-1/2" data-bs-theme="light"></div>
</div>