Centering Items

Centering a fixed element

if your div has a dynamic/undefined width and/or height, then instead of the margin, set the transform to the negative half of the div's relative width and height.

<div class="fixed left-[50%] -translate-x-1/2 m-auto z-20"></div>

Last updated