How to vertically align text next to an image?

Although this seems an easy job for a developer, there are times when we actually search how to do it. This is for those times.

There are many ways to do this. But the best way I found is as follows

.box {
   display: flex;
   align-items:center;
}
<div class="box">
    <img src="https://via.placeholder.com/60x60">
    <span style="">Works.</span>
</div>

Hope this helps you in your programming endeavor.

Leave a Comment

Your email address will not be published. Required fields are marked *

Tweet
Share
Share
Pin