HTML5可以在文档中使用MathML元素,对应的标签是<math>...</math>。
MathML是数学标记语言,是一种基于CML的标准,用来在互联网上书写数学符号和公式的置标语言。
注意:大部分浏览器都支持 MathML 标签,如果你的浏览器不支持该标签,可以使用最新版的 Firefox 或 Safari 浏览器查看。
MathML 实例
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>自选教程(如约智惠.com)</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>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>自选教程(如约智惠.com)</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</mi>
<mo></mo>
<mi>x</mn>
</mrow>
<mo>+</mo>
<mn>4</mn>
</mrow>
<mo>=</mo>
<mn>0</mn>
</mrow>
</math>
</body>
</html>
以下实例是一个2*2的矩阵,可以在Firefox 3.5以上版本查看效果:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>自选教程(如约智惠.com)</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>
参考:
https://www.yuque.com/docs/share/d71e16f2-9816-4994-a28e-8f5a78b80cbb