div arrange items horizontally and vertically code example
Example 1: center div horizontally and vertically
.parent {
position: relative;
}
.child {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
Example 2: how to center horizontally and vertically block div
#html code
CSS is cool
#css code
.parent{
display:grid;
place-items:center;
width:560px;
height: 560px;
}