Reputation: 635
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 ones I can use:
½
⅓ ⅔
¼ ¾
Is this right and why is that? The reason why I ask this is because I've done a Google web search and can't seem to locate any others ... eg. 2/4
Upvotes: 0
Views: 2329
Reputation: 201778
There are several possibilities:
<sub>2</sub>/<sup>4</sup>
. Probably messes up your line spacing, and does not look particularly good.<code>"frac"</code>
feature. Rather limited support in browsers and especially in fonts.\(\frac{2}{4}\)
or some more elaborated TeX code to produce a different style for fraction.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.
Upvotes: 0
Reputation: 12432
As I undserstand HTML5 includes MathML which can represent any fraction you want.
While searching the unicode table I also found these: ⅑ ⅒ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞
.
Upvotes: 1
Reputation: 3149
You can test http://www.mathjax.org/ it is a JavasScript library to make a Math Formula if this is what you want.
Upvotes: 3
Reputation: 21377
The image below displays all unicode-defined fraction symbols. Each of them is treated as one single character. You can use all of them freely, of course, but if you want more, e.g. 123/321
, then you should look out for a library that can create fractions dynamically.
An option for doing so would be using LaTeX. There is another question (with very good answers) on how to do this.
Image from http://symbolcodes.tlt.psu.edu/bylanguage/mathchart.html#fractions
Upvotes: 2
Reputation: 32973
A web page is built up with text, and that text is encoded in a certain character set. The character set you select decides on which characters can be displayed. This also means that characters or symbols that don't exist in the character set cannot be displayed.
As shown in Michael's answer, Unicode defines symbols for a number of fractions. These can be displayed without using all kinds of tricks, for example server or client side generated small bitmaps showing the desired fraction, or as indicated by mohammad mohsenipur a Javascript library that transforms TeX or MathML.
Upvotes: 0