xxxxxxxxxx
.element {
position: absoloute;
margin: auto;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
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
div {
width: 100px;
height: 100px;
background-color: red;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}