HTML5的HTML语法允许我们在文档内使用<math>...</math>标签应用MathML元素。
下面是一个使用MathML的有效HTML5文档:
XML/HTMLCode复制内容到剪贴板
html
<!doctypehtml>
<html>
<head>
<metacharset="UTF-8">
<title>Pythagoreantheorem</title>
</head>
<body>
<mathxmlns="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>
这会生成如下结果:
复制代码
代码如下:
a2+b2=c2
便于学习这一概念-请使用FireFox3.7或更高版本进行在线练习。
使用MathML字符
想象一下,下面是一个使用字符⁢的标记:
XML/HTMLCode复制内容到剪贴板
html
<!doctypehtml>
<html>
<head>
<metacharset="UTF-8">
<title>MathMLExamples</title>
</head>
<body>
<mathxmlns="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>
这会生成如下结果
复制代码
代码如下:
x2+4x+4=0
便于学习这一概念-请使用FireFox3.7或更高版本进行在线练习。
矩阵表达示例
想象一下下面的例子,它会被用来表示一个简单的2x2矩阵:
XML/HTMLCode复制内容到剪贴板
html
<!doctypehtml>
<html>
<head>
<metacharset="UTF-8">
<title>MathMLExamples</title>
</head>
<body>
<mathxmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<mi>A</mi>
<mo>=</mo>
<mfencedopen="["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>

本文转载自中文网

本文转载自中文网
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html5/h55008.shtml