HTML5 - MathML

HTML5 - MathML 首页 / HTML5入门教程 / HTML5 - MathML

HTML5的HTML语法允许使用<math> ... </math>标签在文档内部使用MathML元素。

大多数网络浏览器都可以显示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> 

这将产生以下输出-

无涯教程网

链接:https://www.learnfk.comhttps://www.learnfk.com/html5/html5-mathml.html

来源:LearnFk无涯教程网

MathML字符

<!doctype html>

<html>
   <head>
      <meta charset="UTF-8">
      <title>MathML Example</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>&InvisibleTimes;</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或更高版本。

这将产生以下输出-

无涯教程网

链接:https://www.learnfk.comhttps://www.learnfk.com/html5/html5-mathml.html

来源:LearnFk无涯教程网

Matrix 示例

考虑以下示例,该示例将用于表示一个简单的2x2矩阵-

<!doctype html>

<html>
   <head>
      <meta charset="UTF-8">
      <title>MathML Example</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.learnfk.comhttps://www.learnfk.com/html5/html5-mathml.html

来源:LearnFk无涯教程网

这将产生以下输出。如果看不到正确的输出,请使用Firefox 3.5或更高版本。

MathML

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

趣谈网络协议 -〔刘超〕

邱岳的产品实战 -〔邱岳〕

数据结构与算法之美 -〔王争〕

Linux性能优化实战 -〔倪朋飞〕

Netty源码剖析与实战 -〔傅健〕

手机摄影 -〔@随你们去〕

程序员的测试课 -〔郑晔〕

Spring Cloud 微服务项目实战 -〔姚秋辰(姚半仙)〕

现代C++20实战高手课 -〔卢誉声〕

好记忆不如烂笔头。留下您的足迹吧 :)