mozilla

Revision 479617 of <msub>

  • Revision slug: Web/MathML/Element/msub
  • Revision title: <msub>
  • Revision id: 479617
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment doc bug 827713

Revision Content

{{MathMLRef()}}

The MathML <msub> element is used to attach a subscript to an expression.
It uses the following syntax: <msub> base subscript </msub>.

Attributes

class, id, style
Provided for use with stylesheets.
href
Used to set a hyperlink to a specified URI.
mathbackground
The background color. You can use #rgb, #rrggbb and HTML color names.
mathcolor
The text color. You can use #rgb, #rrggbb and HTML color names.
subscriptshift
The minimum space by which to shift the subscript below the baseline of the expression, as a length value.

Examples

Rendering: x1

<math>

  <msub>
    <mi>X</mi>
    <mn>1</mn>
  </msub> 

</math>

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{ CompatNo() }} (24 only) {{ CompatGeckoDesktop("1.0") }} {{ CompatNo() }} 9.5 5.1
href {{ CompatNo() }} {{webkitbug(85733)}} {{ CompatGeckoDesktop("7.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }} {{webkitbug(85733)}}
mathbackground {{ CompatNo() }} (24 only) {{ CompatGeckoDesktop("2.0") }} {{ CompatNo() }} {{ CompatNo() }} 5.1
mathcolor {{ CompatNo() }} (24 only) {{ CompatGeckoDesktop("2.0") }} {{ CompatNo() }} {{ CompatNo() }} 5.1
subscriptshift {{ CompatNo() }} {{ CompatGeckoDesktop("1.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ 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() }}
subscriptshift {{ CompatNo() }} {{ CompatNo() }} {{ CompatGeckoMobile("1.0") }} {{ CompatNo() }} {{ CompatNo() }} {{ CompatNo() }}

Gecko-specific notes

  • Starting with Gecko 26.0 {{geckoRelease("26")}} it is no longer possible to use <none /> as a child element. The rendering has been made more consistent with equivalent configurations of {{MathMLElement("msup")}} and {{MathMLElement("mmultiscripts")}} and a bug with an incorrect application of the superscriptshift attribute has been fixed (see {{bug("827713")}} for details).

Specifications

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

See also

  • {{ MathMLElement("msup") }} (Superscript)
  • {{ MathMLElement("msubsup") }} (Subscript-superscript pair)
  • {{ MathMLElement("mmultiscripts") }} (Prescripts and tensor indices)

Revision Source

<p>{{MathMLRef()}}</p>
<p>The MathML <code>&lt;msub&gt;</code> element is used to attach a subscript to an expression.<br />
  It uses the following syntax: <code>&lt;msub&gt; <em>base subscript</em> &lt;/msub&gt;</code>.</p>
<h2 id="Attributes">Attributes</h2>
<dl>
  <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-href">
    href</dt>
  <dd>
    Used to set a hyperlink to a specified URI.</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. 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-subscriptshift">
    subscriptshift</dt>
  <dd>
    The minimum space by which to shift the subscript below the baseline of the expression, as a <a href="/en-US/docs/MathML/Attributes/Values#Lengths">length value</a>.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<p>Rendering: <img alt="x1" src="/files/3202/msub.png" style="vertical-align: middle; margin-left: 10px;" /></p>
<pre class="brush: html">
&lt;math&gt;

&nbsp; &lt;msub&gt;
&nbsp;&nbsp;&nbsp; &lt;mi&gt;X&lt;/mi&gt;
&nbsp;&nbsp;&nbsp; &lt;mn&gt;1&lt;/mn&gt;
&nbsp; &lt;/msub&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>{{ CompatNo() }} (24 only)</td>
        <td>{{ CompatGeckoDesktop("1.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>9.5</td>
        <td>5.1</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>{{ CompatNo() }} (24 only)</td>
        <td>{{ CompatGeckoDesktop("2.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>5.1</td>
      </tr>
      <tr>
        <td><code>mathcolor</code></td>
        <td>{{ CompatNo() }} (24 only)</td>
        <td>{{ CompatGeckoDesktop("2.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>5.1</td>
      </tr>
      <tr>
        <td><code>subscriptshift</code></td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoDesktop("1.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</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>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>
      <tr>
        <td><code>subscriptshift</code></td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoMobile("1.0") }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatNo() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h3 id="Specifications" name="Specifications">Gecko-specific notes</h3>
<ul>
  <li>Starting with Gecko 26.0 {{geckoRelease("26")}} it is no longer possible to use <code>&lt;none /&gt;</code> as a child element. The rendering has been made more consistent with equivalent configurations of {{MathMLElement("msup")}} and {{MathMLElement("mmultiscripts")}} and a bug with an incorrect application <code>of the </code><code>superscriptshift</code> attribute has been fixed (see {{bug("827713")}} for details).</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.msub', 'msub') }}</td>
      <td>{{ Spec2('MathML3') }}</td>
      <td>Current specification</td>
    </tr>
    <tr>
      <td>{{ SpecName('MathML2', 'chapter3.html#presm.msub', 'msub') }}</td>
      <td>{{ Spec2('MathML2') }}</td>
      <td>Initial specification</td>
    </tr>
  </tbody>
</table>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{ MathMLElement("msup") }} (Superscript)</li>
  <li>{{ MathMLElement("msubsup") }} (Subscript-superscript pair)</li>
  <li>{{ MathMLElement("mmultiscripts") }} (Prescripts and tensor indices)</li>
</ul>
Revert to this revision