Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aligning images with text [duplicate]

I'm having trouble aligning an image with text. I want my image on the left, and the text inline on the right, centered vertically to the image.

<div class="container">
    <span class="icon">
        <img ... />
    </span>
    <span>555-1212</span>
</div>

Right now, the text hugs the top of the container. How can I center it vertically to the middle of the container?

like image 564
vintorg Avatar asked May 12 '26 21:05

vintorg


1 Answers

.container span {
    display: inline-block;
    vertical-align: middle;
}

This should do it. jsFiddle

like image 152
Stephan Muller Avatar answered May 15 '26 11:05

Stephan Muller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!