MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

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

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support No support 1.0 (1.7 or earlier) No support No support 5.1
bevelled No support 1.0 (1.7 or earlier) No support No support No support
href No support 7.0 (7.0) No support No support 10.0 WebKit bug 85733
mathbackground No support 4.0 (2.0) No support No support 5.1
mathcolor No support 4.0 (2.0) No support No support 5.1
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support No support 1.0 (1.0) No support No support No support
bevelled No support No support 1.0 (1.0) No support No support No support
href No support No support 7.0 (7.0) No support No support No support
mathbackground No support No support 4.0 (2.0) No support No support No support
mathcolor No support No support 4.0 (2.0) No support No support No support

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: Yaffle, fscholz, fred.wang, Sheppy, jswisher
 Last updated by: Yaffle,