MathML is a W3C recommendation that defines an XML vocabulary for marking mathematical expressions, a markup language for writing mathematical symbols and formulas on the Internet.
HTML5 can use MathML elements in documents, and the corresponding tags are <math>...</math>.
Pythagorean theorem example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>php中文网(php.cn)</title> </head> <body> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> <msup><mi>X</mi><mn>2</mn></msup> <mo>+</mo> <msup><mi>Y</mi><mn>2</mn></msup> <mo>=</mo> <msup><mi>Z</mi><mn>2</mn></msup> </mrow> </math> </body> </html>
Note: The best effect is to open it with Firefox browser . Other browsers may have minor bugs.
## Euler’s formula:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>php中文网(php.cn)</title> </head> <body> <math xmlns="http://www.w3.org/1998/Math/MathML"> <msup><mi>e</mi><mi>iπ</mi></msup> <mo>+</mo> <mn>1</mn> <mo>=</mo> <mn>0</mn> </math> </body> </html>
Matrix expression example:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>php中文网(php.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>
Note: Please Open with Firefox browser.