The goal is to vertically and horizontally align a group of tspan elements.
However, the parent container does not account for dy values.
This causes alignment issues.
If you play with the dy values of this Codepen, the text container height remains the same all the time: https://codepen.io/anon/pen/WLpvrG?editors=1111.
How can you get an accurate bounding rectangle for tspan elements?
<svg id="textBox1" class="textBox" x="0%" y="0%" width="100%" height="25%">
<rect class="background" x="0%" y="0%" width="100%" height="100%" fill="gray" fill-opacity="0.5" />
<text class="tspanGroup" x="0" y="0"><tspan x="50%" dy="0em" text-anchor="middle">tspan line 0</tspan><tspan x="50%" dy="1.5em" text-anchor="middle">tspan line 1</tspan><tspan x="50%" dy="1.5em" text-anchor="middle">tspan line 2</tspan></text>
</svg>