Using Fractions On Websites

前端 未结 5 771
时光取名叫无心
时光取名叫无心 2020-12-12 07:15

Is it possible to use any fraction symbol on a website, represented as ¼ rather than 1/4 for example?

From what I\'ve gathered, these are the only

5条回答
  •  感动是毒
    2020-12-12 07:35

    There are several possibilities:

    • Use special character for fractions. Not possible for 2/4 for example, and problematic in font support for all but the three most common (vulgar) fractions you had found.
    • Use markup like 2/4. Probably messes up your line spacing, and does not look particularly good.
    • Construct a fraction using some CSS for positioning and size control and using fraction slash character instead of the common slash. Rather awkward really, I would say.
    • Use OpenType "frac" feature. Rather limited support in browsers and especially in fonts.
    • MathJax, e.g. \(\frac{2}{4}\) or some more elaborated TeX code to produce a different style for fraction.
    • MathML. Verbose, and browser support to MathML inside HTML could be better.

    These are explained more and illustrated in my page “Math in HTML (and CSS)”, section Fractions.

    The choice thus depends on many factors. It also depends on the font quite a lot. I suggest that you test the different options using the font family declaration you intend to use. Despite the many alternatives, you might end up with using just the simple linear notation like 2/4.

提交回复
热议问题