How to show fraction in svg if i am using text for now any other alternative using svg

后端 未结 1 661
灰色年华
灰色年华 2021-01-28 04:27

I want the text to show a number in the form a/b. How can I do in SVG

E.g.

相关标签:
1条回答
  • 2021-01-28 05:30

    You could display it via unicode superscript and subscript characters like this.

    <svg>
      <text x="20" y="30" font-family="Cambria" font-size="20px">Fraction: &#179;⁄&#8322;</text>
    </svg>

    or this where dx is used to make the letters appear in the same place.

    <svg>
      <text x="20" y="30" font-family="Cambria" font-size="20px">Fraction: <tspan dx="0 -11.5 -11.5">&#179;&#8213;&#8322;</tspan></text>
    </svg>

    0 讨论(0)
提交回复
热议问题