files/en-us/web/mathml/reference/element/mtable/index.md
The <mtable> MathML element allows you to create tables or matrices. Its children are {{ MathMLElement("mtr") }} elements (representing rows), each of them having {{ MathMLElement("mtd") }} elements as its children (representing cells). These elements are similar to {{ HTMLElement("table") }}, {{ HTMLElement("tr") }} and {{ HTMLElement("td") }} elements of HTML.
This element's attributes include the global MathML attributes. Some browsers may also support the following attributes:
align {{Non-standard_Inline}}
: Specifies the vertical alignment of the table with respect to its environment. Possible values are:
axis (default): The vertical center of the table aligns on the environment's axis (typically the minus sign).baseline: The vertical center of the table aligns on the environment's baseline.bottom: The bottom of the table aligns on the environments baseline.center: See baseline.top: The top of the table aligns on the environments baseline.In addition, values of the align attribute can end with a row number (e.g., align="center 3"). This allows you to align the specified row of the table rather than the whole table. A negative Integer value counts rows from the bottom of the table.
columnalign {{Non-standard_Inline}}
columnalign="left right center"). Possible values are: left, center (default) and right.columnlines {{Non-standard_Inline}}
columnlines="none none solid"). Possible values are: none (default), solid and dashed.columnspacing {{Non-standard_Inline}}
columnspacing="1em 2em"). Possible values are {{cssxref("length-percentage")}}.frame {{Non-standard_Inline}}
none (default), solid and dashed.framespacing {{Non-standard_Inline}}
rowalign {{Non-standard_Inline}}
rowalign="top bottom axis"). Possible values are: axis, baseline (default), bottom, center and top.rowlines {{Non-standard_Inline}}
rowlines="none none solid"). Possible values are: none (default), solid and dashed.rowspacing {{Non-standard_Inline}}
rowspacing="1em 2em"). Possible values are {{cssxref("length-percentage")}}.width {{Non-standard_Inline}}
[!NOTE] For the
widthattribute, some browsers may also accept legacy MathML lengths.
<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>
{{EmbedLiveSample('Alignment with row number')}}
{{Specifications}}
{{Compat}}