HTML5 MathML

MathML is highly similar to HTML, but cumbersome. It inherits the use of angle brackets and double labels.

HTML5 can use MathML elements in documents, with the corresponding labels . . . & lt;/math> 。

MathML is a mathematical markup language, a standard based on XML (a subset of standard common markup languages) used to write mathematical symbols and formulas on the Internet.

Note: Most browsers support mathML tags, and if your browser doesn't support them, you can view them using the latest version of Firefox or Safari.


MathML instance

Here's a simple example of MathML:

<!DOCTYPE html><html>
   <head>
      <meta charset="UTF-8">
      <title>W3Cschool在线教程(w3cschool.cn)</title>
   </head>
	
   <body>
	
      <math xmlns="http://www.w3.org/1998/Math/MathML">
		
         <mrow>
            <msup><mi>a</mi><mn>2</mn></msup>
            <mo>+</mo>
				
            <msup><mi>b</mi><mn>2</mn></msup>
            <mo>=</mo>
				
            <msup><mi>c</mi><mn>2</mn></msup>
         </mrow>
			
      </math>
		
   </body>
</html>

Try it out . . .

Run the results diagram as follows:

HTML5 MathML

The following example adds some operators:

<!DOCTYPE html><html>
   <head>
      <meta charset="UTF-8">
      <title>W3Cschool在线教程(w3cschool.cn)</title>
   </head>
	
   <body>
	
      <math xmlns="http://www.w3.org/1998/Math/MathML">
		
         <mrow>			
            <mrow>
				
               <msup>
                  <mi>x</mi>
                  <mn>2</mn>
               </msup>
					
               <mo>+</mo>
					
               <mrow>
                  <mn>4</mn>
                  <mo>⁢</mo>
                  <mi>x</mi>
               </mrow>
					
               <mo>+</mo>
               <mn>4</mn>
					
            </mrow>
				
            <mo>=</mo>
            <mn>0</mn>
				 
         </mrow>
      </math>
		
   </body></html>

Try it out . . .

Run the results diagram as follows:

HTML5 MathML

The following example is a 2×2 matrix that can be seen in versions above Firefox 3.5:

<!DOCTYPE html><html>
   <head>
      <meta charset="UTF-8">
      <title>W3Cschool在线教程(w3cschool.cn)</title>
   </head>
	
   <body>
      <math xmlns="http://www.w3.org/1998/Math/MathML">
		
         <mrow>
            <mi>A</mi>
            <mo>=</mo>
			
            <mfenced open="[" close="]">
			
               <mtable>
                  <mtr>
                     <mtd><mi>x</mi></mtd>
                     <mtd><mi>y</mi></mtd>
                  </mtr>
					
                  <mtr>
                     <mtd><mi>z</mi></mtd>
                     <mtd><mi>w</mi></mtd>
                  </mtr>
               </mtable>
               
            </mfenced>
         </mrow>
      </math>
      
   </body></html>

Try it out . . .

Run the results diagram as follows:

HTML5 MathML