I have this html code
<table style="font-size:10px">
<tr>
<td style="border:1px solid;padding:0">XXX <svg style="vertical-align:middle" width=20px height=20px viewBox="0 0 80 80"><circle cx=40 cy=40 r=40 /></svg>
<td style="border:1px solid;padding:0">XXX
</table>
first XXX is one pixel higher then second. Is it possible to align text like the second XXX? Although I am able to align it correctly, for example with position:absolute for svg, I would like to use this simple way above.
vertical-align: middle(it won't help in the same cell). Of course, you should not mess withabsolute.vertical-alignworks on the entire cell content, not on each separate child element. Good or not, but it never works in general case.vertical-align:middleon your svg element, vertical align it by the distance you want to nudge it. This depends on the height of the SVG, the font-size and the font metrics. It's possible to calculate this, but it's quite fiddly. Eye-balling it though, for your example, a declaration ofvertical-align:-6.5pxseems close enough.