Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write fraction value using html?

I want to write fraction value such as the picture below:

enter image description here

How do I write fraction value using html without using image?

NOTE: I don't want this 1 1/2 pattern but strictly just as the pic above

like image 654
user774411 Avatar asked Sep 23 '11 08:09

user774411


People also ask

How do I type fractions in HTML?

The HTML5 MathML <mfrac> tag is an inbuilt element in HTML5. It is use to add fraction symbol between two digits or equations.

Can you use fractions in CSS?

Yes, you can specify fractional pixels. As this has been part of CSS since the very first version, it should be well supported by any browser that supports CSS at all.


2 Answers

Try the following:

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

This displays as:

112

like image 163
thomson_matt Avatar answered Oct 21 '22 20:10

thomson_matt


.frac {      display: inline-block;      position: relative;      vertical-align: middle;      letter-spacing: 0.001em;      text-align: center;  }  .frac > span {      display: block;      padding: 0.1em;  }  .frac span.bottom {      border-top: thin solid black;  }  .frac span.symbol {      display: none;  } 
1 <div class="frac">      <span>1</span>      <span class="symbol">/</span>      <span class="bottom">2</span>        </div>
like image 31
lokesh Avatar answered Oct 21 '22 19:10

lokesh