<mfrac>

  • Revision slug: MathML/Element/mfrac
  • Revision title: mfrac
  • Revision id: 319635
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment MathML in Chrome 24

Revision Content

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

The syntax is: <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

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>

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 24 {{ CompatGeckoDesktop("1.0") }} {{ CompatNo() }} 9.5 5.1
bevelled {{ CompatNo() }} {{ CompatGeckoDesktop("1.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
href {{ CompatNo() }} {{webkitbug(85733)}} {{ CompatGeckoDesktop("7.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }} {{webkitbug(85733)}}
mathbackground 24 {{ CompatGeckoDesktop("2.0") }} {{ CompatNo() }} {{ CompatNo() }} 5.1
mathcolor 24 {{ CompatGeckoDesktop("2.0") }} {{ CompatNo() }} {{ CompatNo() }} 5.1
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatNo() }} {{ CompatNo() }} {{ CompatGeckoMobile("1.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
bevelled {{ CompatNo() }} {{ CompatNo() }} {{ CompatGeckoMobile("1.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
href {{ CompatNo() }} {{ CompatNo() }} {{ CompatGeckoMobile("7.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
mathbackground {{ CompatNo() }} {{ CompatNo() }} {{ CompatGeckoMobile("2.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
mathcolor {{ CompatNo() }} {{ CompatNo() }} {{ CompatGeckoMobile("2.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}

Gecko-specific notes

  • Starting with Gecko 7.0 {{ geckoRelease("7.0") }} the medium value for the linethickness attribute has been corrected to match the default thickness.

Specifications

Specification Status Comment
{{ SpecName('MathML3', 'chapter3.html#presm.mfrac', 'mfrac') }} {{ Spec2('MathML3') }} Current specification
{{ SpecName('MathML2', 'chapter3.html#presm.mfrac', 'mfrac') }} {{ Spec2('MathML2') }} Initial specification

 

Revision Source

<p>The MathML <code>&lt;mfrac&gt;</code> element is used to display fractions.</p>
<p>The syntax is: <code>&lt;mfrac&gt;<em>numerator</em> <em>denominator</em>&lt;/mfrac&gt;</code>.</p>
<h2 id="Attributes">Attributes</h2>
<dl>
  <dt id="attr-bevelled">
    bevelled</dt>
  <dd>
    Specifies the way the fraction is displayed. If <code>true</code>, 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 <code>false</code> (which is the default value), numerator and denominator are on top of each other.</dd>
  <dt id="attr-class-id-style">
    class, id, style</dt>
  <dd>
    Provided for use with <a href="/en-US/docs/CSS">stylesheets</a>.</dd>
  <dt id="attr-denomalign">
    denomalign</dt>
  <dd>
    The alignment of the denominator under the fraction. Possible values are: <code>left</code>, <code>center</code> (default), and <code>right</code>.</dd>
  <dt id="attr-href">
    href</dt>
  <dd>
    Used to set a hyperlink to a specified URI.</dd>
  <dt id="attr-linethickness">
    linethickness</dt>
  <dd>
    The thickness of the horizontal fraction line. The default value is <code>medium</code>, but <code>thin</code>, <code>thick</code>, and other <a href="/en-US/docs/CSS/length">length values</a> can be set.</dd>
  <dt id="attr-mathbackground">
    mathbackground</dt>
  <dd>
    The background color. You can use <code>#rgb</code>, <code>#rrggbb</code> and <a href="/en-US/docs/CSS/color_value#Color_Keywords">HTML color names</a>.</dd>
  <dt id="attr-mathcolor">
    mathcolor</dt>
  <dd>
    The text color and also the fraction line color. You can use <code>#rgb</code>, <code>#rrggbb</code> and <a href="/en-US/docs/CSS/color_value#Color_Keywords">HTML color names</a>.</dd>
  <dt id="attr-numalign">
    numalign</dt>
  <dd>
    The alignment of the numerator over the fraction. Possible values are: <code>left</code>, <code>center</code> (default), and <code>right</code>.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<p>Rendering: <img alt="(a/b)/(c/d)" src="/files/3194/mfrac.png" style="vertical-align: middle; margin-left: 10px;" /></p>
<pre class="brush: html">
&lt;math&gt;&nbsp; 
  &lt;mfrac bevelled="true"&gt;
     &lt;mfrac&gt;
        &lt;mi&gt; a &lt;/mi&gt;
        &lt;mi&gt; b &lt;/mi&gt;
     &lt;/mfrac&gt;
     &lt;mfrac&gt;
        &lt;mi&gt; c &lt;/mi&gt;
        &lt;mi&gt; d &lt;/mi&gt;
     &lt;/mfrac&gt;
  &lt;/mfrac&gt;
&lt;/math&gt;
</pre>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>24</td>
        <td>{{ CompatGeckoDesktop("1.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>9.5</td>
        <td>5.1</td>
      </tr>
      <tr>
        <td><code>bevelled</code></td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoDesktop("1.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
      </tr>
      <tr>
        <td><code>href</code></td>
        <td>{{ CompatNo() }} {{webkitbug(85733)}}</td>
        <td>{{ CompatGeckoDesktop("7.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }} {{webkitbug(85733)}}</td>
      </tr>
      <tr>
        <td><code>mathbackground</code></td>
        <td>24</td>
        <td>{{ CompatGeckoDesktop("2.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>5.1</td>
      </tr>
      <tr>
        <td><code>mathcolor</code></td>
        <td>24</td>
        <td>{{ CompatGeckoDesktop("2.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>5.1</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Chrome for Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoMobile("1.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
      </tr>
      <tr>
        <td><code>bevelled</code></td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoMobile("1.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
      </tr>
      <tr>
        <td><code>href</code></td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoMobile("7.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
      </tr>
      <tr>
        <td><code>mathbackground</code></td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoMobile("2.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
      </tr>
      <tr>
        <td><code>mathcolor</code></td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoMobile("2.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h3 id="Gecko-specific_notes">Gecko-specific notes</h3>
<ul>
  <li>Starting with Gecko 7.0 {{ geckoRelease("7.0") }} the <code>medium</code> value for the <code>linethickness</code> attribute has been corrected to match the default thickness.</li>
</ul>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table" height="49" width="1000">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ SpecName('MathML3', 'chapter3.html#presm.mfrac', 'mfrac') }}</td>
      <td>{{ Spec2('MathML3') }}</td>
      <td>Current specification</td>
    </tr>
    <tr>
      <td>{{ SpecName('MathML2', 'chapter3.html#presm.mfrac', 'mfrac') }}</td>
      <td>{{ Spec2('MathML2') }}</td>
      <td>Initial specification</td>
    </tr>
  </tbody>
</table>
<p>&nbsp;</p>
Revert to this revision