Encountering a problem with SVG text and feeling unsure about how to handle it
The SVG text I have fits perfectly when the browser or HTML font size is set to 16px. However, if a user increases their font size, the text gets cut off.
How can I ensure that the text stays within the viewport even when the HTML font size is increased?
Check out this fiddle with the default 16px setting - https://jsfiddle.net/f7zv60c5/4/
And here is the fiddle when the font size is increased to 18px - https://jsfiddle.net/f7zv60c5/5/
Below is the HTML code snippet:
<svg class="league_name" viewBox="0 0 240 80" xmlns="http://www.w3.org/2000/svg">
<text text-anchor="middle" x="50%" y="50%">
<tspan class="league_name_text" style="fill:#080e25">Weapons of</tspan>
<tspan class="league_name_text"></tspan>
<tspan class="league_name_text" style="fill:#B82601">DMD</tspan>
<tspan class="league_slogan_text" x="50%" dy="20" style="font-style:italic;fill:#444;font-weight:300">Fantasy Football League</tspan>
<tspan class="establshed-svgtext" x="50%" dy="20" style="fill:#777;font-weight:300;font-style:italic">B.O.T.H 2003</tspan>
</text>
</svg>