When you set your image to a block element you have to center it as a block element with margin: 0 auto
.
@Yoann's solution also works, but the flex
value is not supported by every browser. Have a look at the MDN docs for more information about browser support and values of display
.