CSS: Align Absolute Element Central

This is handy should you need align a popup or any other element vertically/horizontally central to it’s parent container or the viewport when set as absolute.


.element {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

Powered by BetterDocs