Path: blob/main/files/en-us/web/mathml/element/mfrac/index.md
6568 views
------{{MathMLRef}}
The <mfrac> MathML element is used to display fractions. It can also be used to mark up fraction-like objects such as binomial coefficients and Legendre symbols.
Syntax
Attributes
This element's attributes include the global MathML attributes as well as the following attributes:
denomalign{{deprecated_inline}} {{Non-standard_Inline}}: The alignment of the denominator under the fraction. Possible values are:
left,center(default), andright.
linethickness: A
<length-percentage>indicating the thickness of the horizontal fraction line.
numalign{{deprecated_inline}} {{Non-standard_Inline}}: The alignment of the numerator over the fraction. Possible values are:
left,center(default), andright.
Note: For the
linethicknessattribute, some browsers may also accept the deprecated valuesmedium,thinandthick(whose exact interpretation is left to implementers) or legacy MathML lengths.
Examples
Simple fraction
The following MathML code should render as a fraction with numerator "a + 2" and denominator "3 − b":
{{ EmbedLiveSample('simple_fraction', 700, 200, "", "") }}
Fraction without bar
The following MathML code should render as a binomial coefficient:
{{ EmbedLiveSample('Fraction_without_bar', 700, 200, "", "") }}
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}