<mfrac>

The MathML <mfrac> element is used to display fractions.

Syntax

<mfrac>numerator denominator</mfrac>

Attributes

bevelled
Specifies the way the fraction is displayed. If true, the fraction line is bevelled, which means that numerator and denominator are displayed side by side and separated by a slash (/). Otherwise, if set to false (which is the default value), numerator and denominator are on top of each other.
This attribute is deprecated and will be removed in the future. Use U+2044 (fraction slash) instead.
class, id, style
Provided for use with stylesheets.
denomalign
The alignment of the denominator under the fraction. Possible values are: left, center (default), and right.
This attribute is deprecated and will be removed in the future. Use CSS text-align instead.
href
Used to set a hyperlink to a specified URI.
linethickness
The thickness of the horizontal fraction line. This attributes accepts any length values.
The values medium, thin, and thick are deprecated and will be removed in the future.
mathbackground
The background color. You can use #rgb, #rrggbb and HTML color names.
mathcolor
The text color and also the fraction line color. You can use #rgb, #rrggbb and HTML color names.
numalign
The alignment of the numerator over the fraction. Possible values are: left, center (default), and right.
This attribute is deprecated and will be removed in the future. Use CSS text-align instead.

Examples

Sample rendering: (a/b)/(c/d)

Your browser rendering: a b c d

<math> 
  <mfrac bevelled="true">
     <mfrac>
        <mi> a </mi>
        <mi> b </mi>
     </mfrac>
     <mfrac>
        <mi> c </mi>
        <mi> d </mi>
     </mfrac>
  </mfrac>
</math>

Specifications

Specification Status Comment
MathML 3.0
The definition of 'mfrac' in that specification.
Recommendation Current specification
MathML 2.0
The definition of 'mfrac' in that specification.
Recommendation Initial specification

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
mfracChrome No support NoEdge No support NoFirefox Full support 1IE No support NoOpera No support NoSafari Full support 5.1WebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS Full support 5.1Samsung Internet Android No support No
bevelledChrome No support NoEdge No support NoFirefox Full support 1IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
denomalign
Deprecated
Chrome No support NoEdge No support NoFirefox Full support 1
Notes
Full support 1
Notes
Notes Removed from Firefox Nightly 71 in bug 1548530.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
hrefChrome No support NoEdge No support NoFirefox Full support 7IE No support NoOpera No support NoSafari Full support 10WebView Android No support NoChrome Android No support NoFirefox Android Full support 7Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
linethicknessChrome No support NoEdge No support NoFirefox Full support 1IE No support NoOpera No support NoSafari Full support 5.1
Notes
Full support 5.1
Notes
Notes Before Safari 9, <length> values are not supported. Only 0, thin, medium, and thick are supported.
WebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
mathbackgroundChrome No support NoEdge No support NoFirefox Full support 4IE No support NoOpera No support NoSafari Full support 6WebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
mathcolorChrome No support NoEdge No support NoFirefox Full support 4IE No support NoOpera No support NoSafari Full support 6WebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No
numalign
Deprecated
Chrome No support NoEdge No support NoFirefox Full support 1
Notes
Full support 1
Notes
Notes Removed from Firefox Nightly 71 in bug 1548530.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support
Full support
No support
No support
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.