I have this HTML:
<td>
<ol start="4">
<li>
<div style="float:left;">some text</div>
<div style="float:right;">
<img style="vertical-align:middle;" src="pic.png" />
</div>
<div style="clear:both;"></div>
</li>
</ol>
</td>
I tried lots of things including vertical-align:middle to either align the text to the middle of the image or the other way round, nothing changed the result. So far, the top of the image is aligned with the top of the text.
Whats wrong?
Thanks!
Put your “some text” div inside the pic div, set it to
display:inlineso it wont break line and just add thevertical-align:middle, like so:Working fiddle
UPDATE:
To be able to do
vertical-align:middleon several lines breaked by<br>, as OP noted in comments, change the display of “some text” div toinline-tableinstead of justinline, see working jsFiddle