<!DOCTYPE html>
<html>
<head>
<style>
img {
    display: block;
    margin: 0 auto;
}
</style>
</head>
<body>

<h2>Center an Image</h2>
<p>To center an image, use margin: auto; and make it into a block element:</p>

<img src="paris.jpg" alt="Paris" style="width:40%">

</body>
</html>
 

Center an Image

To center an image, use margin: auto; and make it into a block element:

Paris