0 votes
1 view
in Web Technology by (47.8k 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 (107k 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>

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...