MyInternships.in

HTML5 MathML

HTML5 MathML Complete Reference

This reference lists the presentation MathML elements you can use inside the HTML5 <math> root. The table covers token, layout, script and table elements, followed by a runnable example that combines several of them.


MathML Element Reference

ElementDescription
<math>Top-level root that wraps every MathML expression.
<mrow>Groups sub-expressions horizontally as one unit.
<mi>Identifier: variable, constant or function name.
<mn>Numeric literal.
<mo>Operator, fence or separator.
<mtext>Ordinary text within a formula.
<ms>String literal rendered inside quotes.
<mspace>Blank space of a specified size.
<mfrac>Fraction with numerator and denominator.
<msqrt>Square root of its contents.
<mroot>nth root with a radicand and index.
<msup>Superscript (exponent).
<msub>Subscript.
<msubsup>Both subscript and superscript on a base.
<munder>Object placed under a base.
<mover>Object placed over a base.
<munderover>Objects placed both under and over a base.
<mmultiscripts>Multiple pre- and post-scripts on a base.
<mprescripts>Marker inside mmultiscripts for left-side scripts.
<none>Empty script slot inside mmultiscripts.
<mtable>Table or matrix of rows and cells.
<mtr>A row within an mtable.
<mlabeledtr>A labelled table row for numbering.
<mtd>A cell within a table row.
<mfenced>Deprecated auto-bracketing wrapper.
<menclose>Draws enclosing notation such as a box or strike.
<mpadded>Adjusts spacing around its content.
<mphantom>Reserves space but renders invisibly.
<mstyle>Sets style attributes for a whole sub-expression.
<maction>Binds an interactive action (legacy).
<merror>Displays an error message.
<mglyph>Displays a custom glyph or image.

Example

This document uses <mrow>, <mfrac>, <msqrt>, <msup>, <mi>, <mn> and <mo> together to render the golden ratio.

The golden ratio
Example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>MathML Reference Example</title>
</head>
<body>
  <math display="block">
    <mrow>
      <mi>&#966;</mi>
      <mo>=</mo>
      <mfrac>
        <mrow>
          <mn>1</mn><mo>+</mo>
          <msqrt><mn>5</mn></msqrt>
        </mrow>
        <mn>2</mn>
      </mfrac>
    </mrow>
  </math>
</body>
</html>
ℹ️

Most elements here are part of MathML Core and render in modern Chrome, Edge, Firefox and Safari. A few (mfenced, maction, menclose, mglyph, mlabeledtr) are legacy or non-core with weaker support.

Key Takeaways

  • Token elements hold symbols; layout and script elements arrange them.
  • Tables (<mtable>, <mtr>, <mtd>) build matrices and aligned systems.
  • Prefer MathML Core elements; treat mfenced and maction as legacy.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships