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>
提交重置代码
高并发千万级数据库系统解决方案
  • 推荐课程
  • 评论
  • 问答
  • 笔记
  • 课件下载