CSS richten die Elemente vertikaler Zentrum aus
.parent {
display: flex;
justify-content: center;
align-items: center;
}
Gleaming Grivet
.parent {
display: flex;
justify-content: center;
align-items: center;
}
/* 100vh = 100% Viewport Height */
body {
display: flex;
height: 100vh;
flex-direction: column;
justify-content: center;
}
/* add */ align-items: center; /*to also center horizontally.*/
.vertical-center {
margin: 0;
position: absolute;
top: 50%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
<!-- if you use Tailwindcss -->
<div class="absolute top-1/2 transform -translate-y-1/2">
</div>