how to center an image in a div vertically and horizontally code example
Example 1: center an image horizontally and vertically
.center{
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
Example 2: how to center an image element inside a block in css
img { display:block;
margin-left: auto;
margin-right:auto;
}