HTML5 MathML(数学标记)

MathML 是一个 W3C 推荐标准,旨在为标记数学表达式定义一个 XML 词汇表,用来在互联网上书写数学符号和公式的置标语言。

HTML5 可以在文档中使用 MathML 元素,对应的标签是 <math>...</math>

勾股定理实例:

<!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>

注意:使用Firefox火狐浏览器打开效果最好。其他浏览器可能会出现小BUG。


欧拉公式:

<!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&pi;</mi></msup>
<mo>+</mo>
<mn>1</mn>
<mo>=</mo>
<mn>0</mn>
      </math>
   </body>
</html>


矩阵表达示例:

<!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>

注意:请使用Firefox火狐浏览器打开。


继续学习
||
<!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>
提交重置代码
  • 推荐课程
  • 评论
  • 问答
  • 笔记
  • 课件下载
一辆想出轨的无轨电车

一辆想出轨的无轨电车

<math xmlns="http://www.w3.org/1998/Math/MathML">这是什么意思

4年前    添加回复 0

回复
我又来了

我又来了

这个可以的

4年前    添加回复 0

回复
汪汪

汪汪

这个写数学教程可以用到啊

4年前    添加回复 0

回复
check

check

还是做一些特效会好点,毕竟以后也是用样式这块的

4年前    添加回复 0

回复
大神,求带!

大神,求带!

又是数学计算,貌似基本用不到

4年前    添加回复 0

回复
素颜

素颜

<math xmlns="http://www.w3.org/1998/Math/MathML"> <msup><mi>e</mi><mi>i&pi;</mi></msup> <mo>+</mo> <mn>1</mn> <mo>=</mo> <mn>0</mn> </math>

4年前 0

课件暂不提供下载,工作人员正在整理中,后期请多关注该课程~