Use Flexbox
or Grid
. I'll give you an example for Flexbox
that you can reflect on your own case and you can search for the other.
.container {
display:flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
img {
width: 400px;
height: 400px;
margin-right: 10px;
}
<div class = "container">
<img src = "https://www.w3schools.com/howto/img_avatar.png" alt = "Image" />
<p>Some text</p>
</div>
The idea here is you need to wrap your image and text with a parent div
and make it a Flexbox.
flex-direction: row; => Place the items side by side
justify-content: center; => Center the items horizontally
align-items: center; => Center the items vertically
I encourage you to checkout this guide about Flexbox