$1.11

Vertically align text next to an image

Ask a question+
0

Why won’t vertical-align: middle work? And yet, vertical-align: topdoes work.

<div>
   <img style="width:30px;height:30px">
   <span style="vertical-align:middle">Doesn't work.</span>
</div>
add comment

1 Answer

0

Because the vertical-align property must be given to the <img> tag, not span.

<div>
   <img style="width:30px;height:30px;vertical-align:middle">
   <span>Doesn't work.</span>
</div>
add comment

Your Answer