
<mfrac> tag is used to draw fractions.
Here is the simple syntax to use this tag −
<mfrac> numerator denominator </mfrac>
Here is the description of all the parameters of this tag −
numerator − numerator of the fraction.
denominator − denominator of the fraction.
Here is the description of all the attributes of this tag −
linethickness − to specify the stroke width of the fraction bar. values are measured in px, pt, em etc.
numalign − to specify alignment of numerator. values are left, right or center.
denomalign − to specify alignment of denominator. values are left, right or center.
bevelled − to specify whether the fraction should be displayed vertically or inline. values are true or false.
Let's draw a simple fraction for 1/x.
<math xmlns = "http://www.w3.org/1998/Math/MathML">
<mfrac>
<mn>1</mn>
<mi>x</mi>
</mfrac>
</math>
Let's build a complex fraction.
<math xmlns = "http://www.w3.org/1998/Math/MathML">
<mfrac linethickness = '3px'>
<mfrac bevelled = 'true'>
<mn>1</mn>
<mi>x</mi>
</mfrac>
<mrow>
<mi>y</mi>
<mo>-</mo>
<mn>2</mn>
</mrow>
</mfrac>
</math>