how to center a p into a div and an image into a div code example
Example 1: image center in div
img {
display: block;
margin-left: auto;
margin-right: auto;
width: 40%;
}
Example 2: center with css
.parent {
position: relative;
}
.child {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}