I want to write fraction value such as the picture below:
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
The HTML5 MathML <mfrac> tag is an inbuilt element in HTML5. It is use to add fraction symbol between two digits or equations.
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.
Try the following:
1<sup>1</sup>⁄<sub>2</sub>
This displays as:
11⁄2
.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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With