This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

math

Summary

The top-level element in MathML is <math>. Every valid MathML instance must be wrapped in <math> tags. In addition you must not nest a second <math> element in another, but you can have an arbitrary number of other child elements in it.

Overview Table

DOM Interface
mathml

Examples

This example shows a simple formula written in MathML:



<!DOCTYPE html>
<html>
  <head>
    <title>MathML in HTML5</title>
  </head>
  <body>

  <math>
    <mrow>
      <mrow>
        <msup>
          <mi>a</mi>
          <mn>2</mn>
        </msup>
        <mo>+</mo>
        <msup>
          <mi>b</mi>
          <mn>2</mn>
        </msup>
      </mrow>
      <mo>=</mo>
      <msup>
        <mi>c</mi>
        <mn>2</mn>
      </msup>
    </mrow>
  </math>

  </body>
</html>

Related specifications

MathML 3.0
W3C Recommendation

Attributes

In addition to the following attributes, the math element accepts any attributes of the mstyle element.

display
This enumerated attribute specifies how the enclosed MathML markup should be rendered. It can have one of the following values:
  • block, which means that this element will be displayed outside the current span of text, as a block that can be positioned anywhere without changing the meaning of the text;
  • inline, which means that this element will be displayed inside the current span of text, and cannot be moved out of it without changing the meaning of that text.
mode (depreacted)
Deprecated in favor of the display attribute.
Possible values are: display (which has the same effect as display="block") and inline.

Attributions

  • Mozilla Developer Network cc-by-sa-small-wpd.svg: Article