set img to center of div code example
Example 1: image center in div
img {
display: block;
margin-left: auto;
margin-right: auto;
width: 40%;
}
Example 2: how to center an image in css
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}