如果我现在使用文本,则如何在svg中显示分数 [英] How to show fraction in svg if i am using text for now any other alternative using svg

查看:133
本文介绍了如果我现在使用文本,则如何在svg中显示分数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望文本以a/b形式显示数字. 我该如何在SVG <text></text>

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

例如

推荐答案

您可以通过unicode上标和下标字符来显示它.

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>

或使用dx使字母出现在同一位置的

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>

这篇关于如果我现在使用文本,则如何在svg中显示分数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆