I wanted to use some pretty fractions in an article today. I don’t like the look of “1 1/2”, not very elegant.
Of course, the answer lies within HTML special characters. There are a few ways to achieve the same thing:
- ¼ will give you ¼. You can change the ‘1’ and ‘4’ to any other number. But hang on, what would ½4; give you? The answer is ½4;. Hmm…
- The more versatile solution is to use ⁄. However, this won’t format properly without adding <sub> and <sup> like:
Which will output 1⁄10.
Boom! HTML fractions!