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.
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.
href
Used to set a hyperlink to a specified URI.
linethickness
The thickness of the horizontal fraction line. The default value is medium, but thin, thick, and other length values can be set.
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.

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

 

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome No support NoEdge ? Firefox Full support 1IE No support NoOpera No support NoSafari Full support 6WebView Android No support NoChrome Android No support NoEdge Mobile ? Firefox Android Full support 4Opera Android No support NoSafari iOS Full support YesSamsung Internet Android ?
bevelledChrome No support NoEdge ? Firefox Full support 1IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile ? Firefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android ?
hrefChrome No support NoEdge ? Firefox Full support 7IE No support NoOpera No support NoSafari Full support 10WebView Android No support NoChrome Android No support NoEdge Mobile ? Firefox Android Full support 7Opera Android No support NoSafari iOS No support NoSamsung Internet Android ?
mathbackgroundChrome No support NoEdge ? Firefox Full support 4IE No support NoOpera No support NoSafari Full support 6WebView Android No support NoChrome Android No support NoEdge Mobile ? Firefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android ?
mathcolorChrome No support NoEdge ? Firefox Full support 4IE No support NoOpera No support NoSafari Full support 6WebView Android No support NoChrome Android No support NoEdge Mobile ? Firefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

 

Gecko-specific notes

  • Starting with Gecko 7.0 (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4) the medium value for the linethickness attribute has been corrected to match the default thickness.

Document Tags and Contributors

Contributors to this page: lucian95, Yaffle, fscholz, fred.wang, Sheppy, jswisher
Last updated by: lucian95,