HTML Fractions

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 &frac124; give you? The answer is ½4;. Hmm…
  • The more versatile solution is to use &frasl;. However, this won’t format properly without adding <sub> and <sup> like:

    <sup>1</sup>&frasl;<sub>10</sub>

    Which will output 110.

Boom! HTML fractions!

Tags: ,

WordPress SEO: 10 tips for better search rankings

FREE E-book. Learn the basics of WordPress SEO and how to improve the key metrics
  • We won't sell your address to anyone. We hate spam too.
View my portfolio Get in touch