align div align center top and vertically code example
Example 1: css align items vertical center
.parent {
display: flex;
justify-content: center;
align-items: center;
}
Example 2: how to center horizontally and vertically block div
#html code
<div class="parent">
<h1 class="child">CSS is cool</h1>
</div>
#css code
.parent{
display:grid;
place-items:center;
width:560px;
height: 560px;
}