How should I express fractions like 15/16ths in HTML?

前端 未结 7 1480
慢半拍i
慢半拍i 2021-02-05 04:49

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?

7条回答
  •  借酒劲吻你
    2021-02-05 05:28

    For the existing fractions as Unicode codepoints (which are mapped to by HTML entities), search for "vulgar fraction" in the Unicode Character Names Index.

    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 slash character.

    Your example implemented as above:

    ¹⁵⁄₁₆

提交回复
热议问题