xxxxxxxxxx
element {display: block; float: left; vertical-align: middle; text-align: center}
xxxxxxxxxx
.center {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
xxxxxxxxxx
// add to the parent element
.parent {
display: grid;
place-items: center;
}
xxxxxxxxxx
.center{
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
xxxxxxxxxx
.element {
position: absoloute;
margin: auto;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
xxxxxxxxxx
/* CSS */
.mx-auto {margin-left: auto;margin-right: auto;}
<!-- HTML -->
<div class="mx-auto">
<!-- content -->
</div>