In your current attempt, class="center"
would have no meaning unless you have a class called .center
defined in your CSS. It doesn't look like you have a stylesheet, though.
Here are two ways to center an image horizontally:
- Use
text-align: center
on a parent element:
<div style="text-align: center;">
<h1>Title TEST</h1>
<img src="https://via.placeholder.com/350x150" />
<footer>
<p>Footer TEST</p>
</footer>
</div>
- Center the image element itself by making it
block
-level and giving it a margin-left
and margin-right
of 0
:
<h1 style="text-align: center;">Title TEST</h1>
<img style="display: block; margin: 0 auto;" src="https://via.placeholder.com/350x150" />
<footer>
<p style="text-align: center;">Footer TEST</p>
</footer>