HTML5的HTML语法允许使用<math> ... </ math>标记在文档内部使用MathML元素。
大多数Web浏览器都可以显示MathML标签。如果您的浏览器不支持MathML,则建议您使用最新版本的Firefox。
MathML范例
以下是带有MathML的有效HTML5文档-
现场演示
<!doctype html>
<html>
<head>
<meta charset = "UTF-8">
<title>Pythagorean theorem</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>
这将产生以下结果-
使用MathML字符
考虑一下,下面是使用字符&InvisibleTimes;的标记;-
现场演示
<!doctype html>
<html>
<head>
<meta charset = "UTF-8">
<title>MathML Examples</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>
这将产生以下结果。如果看不到正确的结果,例如x 2 + 4x + 4 = 0,请使用Firefox 3.5或更高版本。
这将产生以下结果-
矩阵演示示例
考虑以下示例,该示例将用于表示一个简单的2x2矩阵-
现场演示
<!doctype html>
<html>
<head>
<meta charset = "UTF-8">
<title>MathML Examples</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>
这将产生以下结果-
如果您觉得本文的内容对您的学习有所帮助:
关键字:
网站优化 SEO