horizontally and vertically center element css code example
Example 1: css align center vertical and horizontal
.parent-class {
display: flex;
align-items: center;
justify-content: space-around;
}
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;
}