The Wayback Machine - https://web.archive.org/web/20240823224738/https://www.geeksforgeeks.org/html5-mathml-introduction/
Open In App

HTML5 MathML Introduction

Last Updated : 05 Jul, 2023
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The MathML comes in HTML5 the current MathML version is 3 it was introduced in the year of 2015. MathML stands for Mathematics Markup Language. It is used to represent mathematical equations or expressions in web browsers like other HTML elements. The 1st version of MathML was released in the year of 1998 and after that the 2nd version was released. 

Basically, MathML is a complex mathematical formula or equation visual representation made easy. The MathML is supported in HTML5, all the MathML tags must be used inside the <math> and </math> tags. The MathML is used to describe mathematics as a basis for the machine to machine communication, it is intended to be handled by specialized authoring tools such as equation editors and it is meaningful to other applications also. 

MathML is not-capable:

  • The MathML is not a calculator to calculate or solve complex equations it is just a way to show the equation.
  • It is not a programming language it is a Mathematics Markup Language.

MathML is capable:

  • The MathML can be used to represent the Matrix form.
  • The MathML can be used to represent the Partial Differential Equation.
  • The MathML can be used to represent the Chemical Reaction Equation.

The below example gives you a brief idea about MathML: 

Example: 

html




<!DOCTYPE html>
<html>
 
<head>
    <title>HTML5 MathML</title>
</head>
 
<body style="text-align:center;">
 
    <h1 style="color:green">
        GeeksforGeeks
    </h1>
 
    <h3>HTML5 MathML</h3>
 
    <!--start tag of the whole representation-->
    <math>
 
        <!-- Creating Matrix -->
        <mrow>
            <mi>A</mi>
            <mo>=</mo>
 
            <mfenced open="[" close="]">
 
                <mtable>
                    <mtr>
                        <mtd>
                            <mi>a</mi>
                        </mtd>
                        <mtd>
                            <mi>b</mi>
                        </mtd>
                    </mtr>
 
                    <mtr>
                        <mtd>
                            <mi>x</mi>
                        </mtd>
                        <mtd>
                            <mi>y</mi>
                        </mtd>
                    </mtr>
 
                </mtable>
 
            </mfenced>
        </mrow>
 
        <!-- Creating equation -->
        <br><br>
        <msub>
            <mi>Geeks</mi>
            <mn>4</mn>
        </msub>
        <mo>+</mo>
        <mn>Geeks</mn>
        <mo>=</mo>
        <msub>
            <mi>G</mi>
        </msub>
        <mo>→</mo>
        <msub>
            <mi>e</mi>
            <mn>2</mn>
        </msub>
        <mo>→</mo>
        <mi>k</mi>
        <mi>s</mi>
        <mn>4
        </mn>
        <msub>
            <mi>G</mi>
        </msub>
        <mo>→</mo>
        <msub>
            <mi>e</mi>
            <mn>2</mn>
        </msub>
        <mo>→</mo>
        <mi>k</mi>
        <mi>s</mi>
    </math>
</body>
 
</html>


Output:

  

Note: There are almost 30+ MathML tags available. All the tags are listed below in table format:

Tag

Description

MathML <math> tag MathML element you want to use they should wrapped inside of the <math> tag.
MathML <maction> tag This tag is used to show the bind action of any expression.
MathML <menclose> Tag This tag is used to renders the contents which is inside of an enclosing notation specified by the notation attribute.
MathML <merror> Tag This tag is used to wrap the expression in a box, makes that expression eye-catching.
MathML <mfenched> tag This tag is used to add custom open and closing parentheses.
MathML <mfrac> tag This tag is use to add fraction symbol between two digits or equations.
MathML <mglyph> Tag This tag is used only for those characters or symbols that are not available on Unicode characters.
MathML <mi> Tag This tag is used as an identifier such as any kind of symbol or function. You can put any statement inside this tag.
MathML <mlabeledtr> tag This tag is used to represent a label in a row, either on the left or on the right side inside of the <mtable> element.
MathML <mmultiscripts> Tag This tag is used to create multi-dimensional matrices. The degree depends on the conditionality of a representative array.
MathML <mn> Tag THis tag is used to display a numeric character which is normally a sequence of digits with a possible separator.
MathML <mo> Tag This tag is used print operator between elements. Any kind of mathematical operator can be used by this tag.
MathML <mover> Tag This tag is used to attach an accent or a limit over an expression.
MathML <mpadded> Tag This tag is used to add extra padding and to set the general adjustment of position and size of enclosed contents.
MathML <mphantom> Tag It is used to rendered invisibly but the dimensional are still kept.
MathML <mroot> Tag This tag is use to display the power of the root like root squire.
MathML <mrow> Tag This tag is used to create a row that contains some mathematical expression or any random text.
MathML <ms> Tag This tag is used to represent string that will represent the mathematical expression by programming languages and computer algebra systems.
MathML <mspace> Tag This tag is used to print blank space. The size of the blank space has to be mentioned in the attributes.
MathML <msqrt> Tag It is use to display the root squire of the element content.
MathML <style> Tag It is an inbuilt tag in HTML5. This tag is used to change the styles of the children elements.
MathML <msub> Tag It is used to print the base power on any expression.
MathML <msubsup> Tag It is used to print base power and power on any expression.
MathML <msup> Tag It is used to print power on any expression.
MathML <mtable> Tag This tag is similar to the normal HTML <table> tag.
MathML <mtd> Tag This tag is used to create table data of a table or the matrices in HTML5
MathML <mtext> Tag This tag is used to print any text before after any expression.
MathML <mtr> Tag This tag is used to create row of a table or the matrices in HTML5.
MathML <mth> Tag This tag is used to create header of a table or the matrices in HTML5.
MathML <munder> Tag This tag is used attach any accent or limit under the expression.
MathML <munderover> Tag This tag is used attach any accent or limit under the expression plus over the expression.
MathML <semantics> Tag This tag is used to markup the mathematics there are two possible ways to markup mathematics

Supported Browsers: The browsers supported by HTML5 MathML tags are listed below:

  • Firefox


Previous Article
Next Article

Similar Reads

HTML5 MathML &lt;menclose&gt; Tag
The HTML5 MathML &lt;menclose&gt; tag tag is an inbuilt element in HTML5. It is used to renders the contents which is inside of anbenclosing notation specified by the notation attribute. Syntax: &lt;menclose attribute="value "&gt; child elements &lt;/menclose"&gt;Attributes: The tag accepts some attributes which are listed below: class| id| style:
2 min read
HTML5 MathML rowspan Attribute
This attribute holds the value that how many rows does the cell extend. This attribute is accepted by the &lt;mtd&gt; tag only. Syntax: &lt;element rowspan="non-negative-int"&gt; Attribute Values: non-negative-int: This value holds the integer that create the span by rows. Below example illustrate the rowspan in HTML MathML: Example: C/C++ Code
1 min read
HTML5 MathML rowlines Attribute
This attribute holds the row borders value that multiple value can be separated by using a space can consider also. Possible values are none, solid and dashed. This attribute is accepted by &lt;mtable&gt; tag only. Syntax: &lt;element rowlines="none|solid|dashed"&gt; Attribute Values: none: This attribute sets the row lines of the table none.solid:
1 min read
HTML5 MathML &lt;merror&gt; Tag
The HTML5 MathML &lt;merror&gt; tag tag is an inbuilt element in HTML5 which is used to wrap the expression in a box, makes that expression eye-catching. This tag is used to display the error message. Normally it alone can't just pop out when your MathML markup is wrong or any kind of error occurs, you will get an XML parsing. Syntax: &lt;merror
2 min read
HTML5 MathML &lt;maction&gt; tag
The HTML5 MathML &lt;maction&gt; tag is an inbuilt element of HTML5, that is used to show the bind action of any expression. You can use any selection attribute with this element. Syntax: &lt;maction&gt; child elements &lt;/maction&gt; Attributes: The &lt;maction&gt; tag accepts below-mentioned attributes: actiontype: This attribute contains three
2 min read
HTML5 MathML &lt;mfrac&gt; tag
The HTML5 MathML &lt;mfrac&gt; tag is an inbuilt element in HTML5. It is use to add fraction symbol between two digits or equations. Syntax: &lt;mfrac&gt; numerator denominator &lt;/mfrac&gt; Attributes: This tag accepts below mentioned attribute: bevelled: This attribute holds the value how the fraction will be displayed if the value is true then
2 min read
HTML5 MathML &lt;mglyph&gt; Tag
The MathML &lt;mglyph&gt; tag in HTML5 is used to print non-standard symbols. It is used only for those characters or symbols that are not available on Unicode characters. Syntax: &lt;mglyph src="pathe" alt="" width="value" height="value"/&gt;Attributes: This tag accepts some attributes which are listed below: alt: This attribute defines the altern
1 min read
HTML5 MathML &lt;mn&gt; Tag
The MathML &lt;mn&gt; tag in HTML5 is used to display a numeric character which is normally a sequence of digits with a possible separator. It contains the arbitrary character and used like 4 as Four. Syntax: &lt;mn&gt; Numeric &lt;/mn&gt;Attributes: It accepts some attributes which are listed below: class|id|style: This attribute is used to hold t
2 min read
HTML5 MathML &lt;mlabeledtr&gt; tag
The MathML &lt;mlabeledtr&gt; tag in HTML5 is used to represent a label in a row, either on the left or on the right side inside of the &lt;mtable&gt; element. Child of this element is similar to normal table followed by m like &lt;td&gt; become &lt;mtd&gt;. Syntax: &lt;mlabeledtr&gt; element &lt;/mlabeledtr&gt; Attributes: This tag accepts some at
2 min read
HTML5 MathML &lt;mfenched&gt; tag
The MathML &lt;mfenched&gt; tag in HTML5 is used to add custom open and closing parentheses. Like you can open any parentheses and can close different brackets and separators. Syntax: &lt;mfenced open="parentheses" close="parentheses" separators=" "&gt; child elements&lt;/mfenced&gt;Attributes: This tag accepts some attribute which are listed below
1 min read
HTML5 MathML &lt;math&gt; tag
The MathML &lt;math&gt; tag in HTML5 is the most prioritized element. Whatever MathML element you want to use should be wrapped inside of the &lt;math&gt; tag. Syntax: &lt;math&gt; child elements &lt;/math&gt; Attributes: The tag accepts some attributes which are listed below: class|id|style: This attribute is used to hold the styles of the child e
2 min read
HTML5 MathML &lt;mi&gt; Tag
The MathML &lt;mi&gt; tag in HTML5 is used as an identifier such as any kind of symbol or function. You can put any statement inside this tag. Syntax: &lt;mi&gt; element &lt;/mi&gt; Attributes: This tag accepts some attributes which are listed below: class|id|style: This attribute is used to hold the styles of the child elements.href: This attribut
2 min read
HTML5 | MathML &lt;msubsup&gt; Tag
The MathML &lt;msubsup&gt; tag in HTML5 is used to print base power and power on any expression. This means Superscript and subscript both can be used at the same time. Syntax: &lt;msubsup&gt; child elements &lt;/msubsup&gt; Attributes: This tag accepts some attributes which are listed below: class|id|style: This attribute is used to hold the style
1 min read
HTML5 | MathML &lt;mroot&gt; Tag
The MathML &lt;mroot&gt; tag in HTML5 is use to display the power of the root like root squire.Syntax: &lt;mroot&gt; child elements &lt;/mroot&gt; Attributes: This tag accepts some attributea which are listed below: class|id|style: This attribute holds the styles of the child elements.mathbackground: This attribute holds the value of the math expre
1 min read
HTML5 | MathML &lt;mrow&gt; Tag
The MathML &lt;mrow&gt; tag in HTML5 is used to create a row that contains some mathematical expression or any random text. When you need to write some mathematical expressions, this tag is useful to make a grouping of the expression. By using &lt;mrow&gt; the expression will look nicer, clean with indentation plus line breaking. Syntax: &lt;mrow
2 min read
HTML5 | MathML &lt;mphantom&gt; Tag
The MathML &lt;mphantom&gt; tag in HTML5 is used to rendered invisibly but the dimensional are still kept.Syntax: &lt;mphantom&gt; Child elements &lt;/mphantom&gt; Attributes: This tag accepts some attributes which are listed below: class|id|style: This attribute is used to hold the styles of the child elements.mathbackground: This attribute holds
1 min read
HTML5 MathML &lt;mmultiscripts&gt; Tag
The MathML &lt;mmultiscripts&gt; tag in HTML5 is used to create multi-dimensional matrices. The degree depends on the conditionality of a representative array. As a number/digit is a 0-dimensional array. 1st order Tensor and 2nd order tensor as a squire matrices will represent a 1-dimensional array. Syntax: &lt;mmultiscripts&gt; child elements &lt;
2 min read
HTML5 MathML &lt;mover&gt; Tag
The HTML5 MathML &lt;mover&gt; tag is an inbuilt tag in HTML5. This tag is used to attach an accent or a limit over an expression. Syntax: &lt;mover&gt; base overscript &lt;/mover&gt;Attributes: This tag accepts below mentioned attributes: class|id |style: This attribute holds the styles of the child elements.href: This attribute holds any hyperlin
1 min read
HTML5 MathML &lt;mo&gt; Tag
The MathML &lt;mo&gt; tag in HTML5 is used print operator between elements. Any kind of mathematical operator can be used by this tag. Syntax: &lt;mo&gt; operator &lt;/mo&gt;Attributes: This tag accepts some attributes which are listed below: accent: This attribute is used to specifies whether the operator should be treated as an accent. Possible v
3 min read
HTML5 | MathML &lt;msqrt&gt; Tag
The MathML &lt;msqrt&gt; tag in HTML5 is use to display the root squire of the element content. Syntax: &lt;msqrt&gt; Element contents &lt;/msqrt&gt; Attributes: This tag accepts some attributes which are listed below: class|id|style: This attribute is used to hold the styles of the child elements.mathbackground: This attribute holds the value of t
1 min read
HTML5 | MathML &lt;ms&gt; Tag
The MathML &lt;ms&gt; tag in HTML5 is used to represent string that will represent the mathematical expression by programming languages and computer algebra systems. By default, the string expression enclosed by quotes. Left side of the expression enclosed by lquotes and right side of the expression enclosed by the rquotes. Element of the &lt;ms
2 min read
HTML5 MathML &lt;mpadded&gt; Tag
The MathML &lt;mpadded&gt; tag in HTML5 is used to add extra padding and to set the general adjustment of position and size of enclosed contents. Syntax: &lt;mpadded attribute="value"&gt; &lt;/mpadded&gt; Attributes: class|id|style: This attribute is used to hold the styles of the child elements.mathbackground: This attribute holds the value of the
2 min read
HTML5 | MathML &lt;msup&gt; Tag
The MathML &lt;msup&gt; tag in HTML5 is used to print power on any expression. Syntax: &lt;msup&gt; child elements &lt;/msup&gt; Attributes: This tag accepts some attributes which are listed below: class|id|style: This attribute is used to hold the styles of the child elements.mathbackground: This attribute holds the value of the math expressions b
1 min read
HTML5 | MathML &lt;msub&gt; Tag
The MathML &lt;msub&gt; tag in HTML is used to print the base power on any expression. Syntax: &lt;msub&gt; Contents &lt;/msub&gt; Attributes: This tag accepts some attributes which are listed below: class|id|style: This attribute holds the style of the contents.mathbackground: This attribute holds the value of the math expressions background color
1 min read
HTML5 | MathML &lt;mspace&gt; Tag
The MathML &lt;mspace&gt; tag in HTML5 is used to print blank space. The size of the blank space has to be mentioned in the attributes. Syntax: &lt;mspace attributes="value"/&gt; Attributes: This tag accepts some attributes which are listed below: class|id|style: This attribute holds the styles of the child elements. mathbackground: This attribute
1 min read
HTML5 | MathML &lt;munder&gt; Tag
The MathML &lt;munder&gt; tag in HTML5 is used attach any accent or limit under the expression.Syntax: &lt;munder&gt; base underscript&lt;/munder&gt; Attributes: This tag accepts some attributes which are listed below: accentunder: This attribute defines the tag contains the accent or not. Possible values are true that means the elements is an acce
2 min read
HTML5 | MathML &lt;munderover&gt; Tag
The MathML &lt;munderover&gt; tag in HTML5 is used attach any accent or limit under the expression plus over the expression.Syntax: &lt;munderover&gt; base underscript &lt;/munderover&gt; Attributes: This tag accepts some attributes which are listed below: accent: This attribute specifies whether the operator should be treated as an accent. Possibl
2 min read
HTML5 | MathML &lt;mtext&gt; Tag
The MathML &lt;mtext&gt; tag in HTML5 is used to print any text before after any expression. You can use this tag to signify the expression or can give a name to that expression. Use to print comments about any expression this tag has been used.Syntax: &lt;mtext attributes="values"&gt; Random text &lt;/mtext&gt; Attributes: This tag accepts some at
2 min read
HTML5 | MathML &lt;mtd&gt; Tag
The MathML &lt;mtd&gt; tag is used to create table data of a table or the matrices in HTML5. It is similar to &lt;td&gt; of a table tag.Syntax: &lt;mtd attributes="value"&gt; child elements &lt;/mtd&gt; Attributes: It accepts some attributes which are listed below: class|id|style: This attribute is used to hold the styles of the child elements.colu
2 min read
HTML5 | MathML &lt;mtable&gt; Tag
The MathML &lt;mtable&gt; tag is used to create table or the matrices in HTML5. This tag is similar to the normal HTML &lt;table&gt; tag. The &lt;table&gt; has the &lt;tr&gt;, &lt;td&gt; and &lt;td&gt; tag, similarly it has the &lt;mtr&gt;, &lt;mtd&gt; and &lt;mtd&gt; tag, that act as same as those. But we don't use the &lt;table&gt; and other sub
3 min read
three90RightbarBannerImg