我应该如何在 HTML 中表达像 15/16ths 这样的分数?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/173332/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How should I express fractions like 15/16ths in HTML?
提问by raldi
I know there are HTML entities for 1/2, 1/4, and 3/4, but are there others? Like 1/3 or 1/8? Is there a good way to encode arbitrary fractions?
我知道有 1/2、1/4 和 3/4 的 HTML 实体,但还有其他的吗?像 1/3 还是 1/8?有没有一种对任意分数进行编码的好方法?
回答by Henrik Paul
how about 15⁄16? (<sup>15</sup>⁄<sub>16</sub>)
怎么样15/ 16个?(<sup>15</sup>⁄<sub>16</sub>)
回答by scronide
1/2 → ½ or ½
1/4 → ¼ or ¼
3/4 → ¾ or ¾
1/8 → ⅛ or ⅛
3/8 → ⅜ or ⅜
5/8 → ⅝ or ⅝
7/8 → ⅞ or ⅞
1/3 → ⅓
2/3 → ⅔
1/5 → ⅕
2/5 → ⅖
3/5 → ⅗
4/5 → ⅘
1/6 → ⅙
5/6 → ⅚
...but you could also encode them as decimals: 15/16 = 0.9375 ;)
...但您也可以将它们编码为小数:15/16 = 0.9375 ;)
回答by tzot
For the existing fractions as Unicode codepoints (which are mapped to by HTML entities), search for "vulgar fraction" in the Unicode Character Names Index.
对于作为 Unicode 代码点的现有分数(由 HTML 实体映射到),请在Unicode 字符名称索引 中搜索“粗俗分数” 。
Now, for generic fractions, which work in HTML but also work in plain text, use the super- and subscript digits (see Unicode Codepoint Chart, search for "Superscripts") separated by the fraction slashcharacter.
现在,对于可以在 HTML 中使用但也可以在纯文本中使用的通用分数,请使用由分数斜线字符分隔的上标和下标数字(请参阅Unicode 代码点图表,搜索“上标”)。
Your example implemented as above:
您的示例实现如上:
1????
1??
回答by Aleksi Yrttiaho
回答by Darryl Hein
Isn't just 15/16ths alright? Or even 15/16ths(15/16<sup>ths</sup>
)?
不是只有15/16ths好吗?甚至 15/16 ths( 15/16<sup>ths</sup>
)?
回答by epeleg
This would depend on your exact needs and audience. For most purposes many methods would be appropriate. 15/16, 15 parts of 16, 93.75%, 15/16all mean the same, you might even use symbols like ++++++++++++++-
这将取决于您的确切需求和受众。对于大多数目的,许多方法都是合适的。15/16, 16 的 15 部分, 93.75%, 15/ 16 的意思都一样,你甚至可以使用像 ++++++++++++++- 这样的符号
For some more complex scenarios you will need more complex solutions more like LaTeX than html. I believe there are also server side components that take LaTeX descriptions and create images that are browser compatible, such as described here: http://www.fauskes.net/nb/htmleqII/
对于一些更复杂的场景,您将需要更复杂的解决方案,比如 LaTeX 而不是 html。我相信还有服务器端组件采用 LaTeX 描述并创建与浏览器兼容的图像,例如此处所述:http: //www.fauskes.net/nb/htmleqII/