<mtable>

Baseline 2023 *
Newly available

Since January 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

* Some parts of this feature may have varying levels of support.

MathML の <mtable> 要素は表や行列を作るのに使えます。<mtable> の中には <mtr><mtd> のみが書けます。これらの要素の関係は,HTML<table><tr><td> の関係に似ています。

属性

この要素の属性にはグローバル MathML 属性があります。一部のブラウザーは以下の属性にも対応していることがあります。

align 非標準

環境に対する表の垂直の配置を指定します。 使用可能な値は以下の通りです。

  • axis (既定値): 表の垂直方向の中心が環境の軸(通常はマイナス記号)に配置される。
  • baseline: 表の垂直方向の中心が、環境のベースライン上に配置されます。
  • bottom: 表の下端が、環境のベースライン上に配置されます。
  • center: baseline を参照。
  • top: 表の上端が、環境のベースライン上に配置されます。

さらに、 align 属性の値は行番号で終えることができます(例: align="center 3")。 これにより、表全体ではなく、指定した行の位置を揃えることができます。負の整数値にすると、表の下端から行数を数えます。

columnalign 非標準

セル内の水平方向の揃えを指定します。スペース区切りで複数の値を書くこともでき,その場合,対応する列に適用されます(例: columnalign="left right center")。使用可能な値は leftcenter(既定値)、right です。

columnlines 非標準

列間罫線を指定します。スペース区切りで複数の値を書くこともでき,その場合、対応する列の間に適用されます(例: columnlines="none none solid")。使用可能な値は none(既定値)、soliddashed です。

columnspacing 非標準

表の列の間の空間を指定します。スペースで区切られた複数の値を指定することができ、対応する列に適用されます(例: columnspacing="1em 2em")。使用可能な値は <length-percentage> です。

frame 非標準

表全体の枠線を指定します。使用可能な値は、 none(既定値)、soliddashed です。

framespacing 非標準

表とフレームの間に追加される空間を指定します。 1 つ目の値は、右と左の空間を指定し、 2 つ目の値は、上と下の空間を指定します。使用可能な値は <length-percentage> です。

rowalign 非標準

セルの垂直方向の揃えを指定します。スペース区切りで複数の値を書くこともでき、その場合、対応する行に適用されます(例: rowalign="top bottom axis")。使用可能な値は axisbaseline(既定値)、bottom,centertop です。

rowlines 非標準

行間罫線を指定します。スペース区切りで複数の値を書くこともでき,その場合、対応する列の間に適用されます。(例: rowlines="none none solid")。使用可能な値は none(既定値)、soliddashed です。

rowspacing 非標準

表の行間の空間を指定します。スペースで区切られた複数の値を指定でき、対応する行に適用されます(例: rowspacing="1em 2em")。使用可能な値は <length-percentage> です。

width 非標準

表全体の幅を示す <length-percentage> を指定します。

メモ: width 属性については、ブラウザーによっては古い MathML の長さも受け入れられるかもしれません。

行番号で揃える

html
<math display="block">
  <mi>X</mi>
  <mo>=</mo>
  <mtable frame="solid" rowlines="solid" align="axis 3">
    <mtr>
      <mtd><mi>A</mi></mtd>
      <mtd><mi>B</mi></mtd>
    </mtr>
    <mtr>
      <mtd><mi>C</mi></mtd>
      <mtd><mi>D</mi></mtd>
    </mtr>
    <mtr>
      <mtd><mi>E</mi></mtd>
      <mtd><mi>F</mi></mtd>
    </mtr>
  </mtable>
</math>

仕様書

Specification
MathML Core
# table-or-matrix-mtable

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
mtable
align
Non-standard
columnalign
Non-standard
columnlines
Non-standard
columnspacing
Non-standard
frame
Non-standard
framespacing
Non-standard
rowalign
Non-standard
rowlines
Non-standard
rowspacing
Non-standard
width
Non-standard
Named spaces (e.g. thinmathspace to mean 3/18em)
DeprecatedNon-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.

関連情報