How to Center an Image with the CSS text-align Property
In general, you cannot use the CSS text-align property to center an image, as it works only on block elements, and the <img> is an inline one. But there is a trick that will help you to center the image with the text-align property. If you need this property for some reasons, you can add a <div> element and specify the text-align property on it. Use the “center” value of this property.