MathML Superscripts
- It is created with the <msup> tag. Place the base inside the <msup> tag, followed by the superscript.
Example
- Write x2, use the following MathML code:
Equivalent MathML code
<math xmlns=<http://www.w3.org/1998/Math/MathML> display='block'>
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
</math>
Output

Output
- <msup> acts more like a function than a normal HTML markup tag. the base and the superscript can be thought of as two "arguments" passed to the <msup>"function" .
- Both arguments need to be a single MathML element (Eg., <mi> or <mn>).
Grouping Sub-Expressions
- Group of sub expression is used to include more than one element. It cannot be passed directly into <msup>.
For Example : If you want to write e2x+1, use the following MathML code:
Equivalent MathML Code
<math xmlns=<http://www.w3.org/1998/Math/MathML> display='block'>
<msup>
<mi>e</mi>
<mrow>
<mn>2</mn>
<mi>x</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msup>
</math>
Output

Output
- The expression like this:

- Create a complex base expression, We have to wrap the superscript argument in an <mrow> element.
For Eg : If you want to write an expression (5x - 3y)2, use the following MathML Code:
Equivalent MathML Code
<math xmlns=<http://www.w3.org/1998/Math/MathML> display='block'>
<msup>
<mrow>
<mo>(</mo>
<mrow>
<mrow><mn>5</mn><mi>x</mi></mrow>
<mo>-</mo>
<mrow><mn>3</mn><mi>y</mi></mrow>
</mrow>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
</math>
Output

Output
Supporting Browsers
Element | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
<msup> | No | No | Yes | No | Only Basic Support |