HTML5 MathML
HTML5 MathML align Attribute
The align attribute controls vertical alignment. On an <mtable> it sets how the whole table lines up with surrounding math; on scripts such as <mover> it can adjust positioning. Values include top, bottom, center, baseline and axis.
Definition and Usage
Use align to raise or lower an element relative to the baseline of the formula around it. On an <mtable>, align="axis" centres the table on the math axis so it sits neatly beside operators; other values move it up or down.
Values
| Value | Effect |
|---|---|
| top | Aligns the top of the element to the baseline. |
| bottom | Aligns the bottom to the baseline. |
| center | Centres the element vertically. |
| baseline | Aligns the element's baseline. |
| axis | Centres on the math axis (default for tables). |
Example
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MathML align attribute</title>
</head>
<body>
<math display="block">
<mrow>
<mi>A</mi><mo>=</mo>
<mo>(</mo>
<mtable align="axis">
<mtr><mtd><mn>1</mn></mtd><mtd><mn>2</mn></mtd></mtr>
<mtr><mtd><mn>3</mn></mtd><mtd><mn>4</mn></mtd></mtr>
</mtable>
<mo>)</mo>
</mrow>
</math>
</body>
</html>ℹ️
align interacts with rowalign and columnalign on tables. Support for some values is limited outside the MathML Core defaults.
Key Takeaways
- align controls vertical positioning relative to the baseline.
- On tables, axis centres the matrix on the math axis.
- Combine with rowalign and columnalign for full control.
