HTML5 MathML

HTML5 MathML align Attribute

The align attribute on <mtable> controls how the table is aligned vertically with respect to the surrounding math - for example centring it on the axis or aligning by its top row.


Definition and usage

The align attribute positions an <mtable> vertically relative to the adjacent content. Values include axis (the default, centred on the math axis), center, baseline, top and bottom. An optional row number can follow to align by a specific row.

Which elements use it

  • <mtable> - vertical alignment of the whole table relative to surrounding math.

Example

A table aligned by its top
<math>
  <mrow>
    <mi>M</mi>
    <mo>=</mo>
    <mtable align="top">
      <mtr><mtd><mn>1</mn></mtd></mtr>
      <mtr><mtd><mn>2</mn></mtd></mtr>
    </mtable>
  </mrow>
</math>

With align="top", the top of the table lines up with the baseline of M and the equals sign.

⚠️

The align attribute on tables is not part of MathML Core and browser support is inconsistent; test carefully or rely on default axis alignment.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships