0 votes
1 view
in Web Technology by (14.7k points)

Why won't vertical-align: middle work? And yet, vertical-align: top does work.

Span{

vertical-align: middle;

}

<div> 

<img src="http://lorempixel.com/30/30/" alt="small img"/>

<span>Doesn't work.</span>

</div>

1 Answer

0 votes
by (33.1k points)

If you want to vertically align text next to an image you can apply the vertical-align to the image. As it is all in one line, son it’s really the image you want to be aligned, not the text.

<div>

<img style="vertical-align:middle" src="https://placehold.it/60x60">

<span style="">Works.</span>

</div>

...