I am creating a website and I am trying to insert this black image in the place of an O in the title, but when I am coding it, the image is not centered and embedded in the middle of the word properly
.
`
<section id="home">
<h1>Pand<img src="assets/webstuff/pandoraxOpng-removebg-preview.png" style="length: 300px; width: 300px; object-position: 5, 5">rax</h1>
<p style="text-align: center; font-size: 125%">Unleashing your true potential.</p>
</section>
`
2
Answers
You can add
display: flex
on the section and then set theflex-direction
to column. This will make the two elements inside your section stack on top of each other. Then addalign-items: center
to center the H1 and P elements within the section element.It’s better to use Flexbox for such cases. The code is explained in the comments.