I have a simple table that contains SVG in the table cells:
<html> <body> <table style="width: 8em;"> <tr> <td style="border: 1px solid black;"> <svg viewBox="0 0 1 1" style="width: 1.37em;" preserveAspectRatio="none"> <polyline points="0,0 1,0.5 0,1" style="fill: blue;"></polyline> </svg> </td> <td style="border: 1px solid black;">Lorem ipsum dolor sit amet</td> </tr> </table> </body> </html>
As you can see, other cells in the row may be too long, thus causing the row height to change relative to the default value, thereby introducing a gap between the SVG and its upper and lower borders.
How can I make an SVG automatically stretch or shrink to fill its cells vertically without changing its horizontal dimensions?
One solution is to make it a background image. You can put the SVG code into a separate file or percent-encode it for use in a data URI.