How can I align text in an SVG without having to do it manually. At the moment I have manually set the positioning of the text inside a rectangle. This is fine, until the value of the text changed and then It looks off and doesnt really work. Is there a way of automatically setting the text to be aligned in the center, similar to text-align:center
so it becomes responsive according to the page?
<svg width="170" height="80" >
<rect width="150" height="70" stroke="#4f7f64" stroke-width="5" fill="white" />
<text x="45" y="25" r="65" font-family="'futura-pt-n7', 'futura-pt' , Helvetica, Arial, sans-serif" font-size="18" fill="black" font-weight="bold"> Settled </text>
<text x="30%" y="55" r="65" font-family="'futura-pt-n7', 'futura-pt' , Helvetica, Arial, sans-serif" font-size="18" fill="black" font-weight="bold"> @String.Format("{0:C0}", Model.ReportTotalData.Select(r => r.Settled).FirstOrDefault()) </text>
</svg>