HTML5 MathML
HTML5 MathML rowalign Attribute
The rowalign attribute sets how cells are aligned vertically within table rows. It applies to <mtable> (setting a default for all rows) and <mtr> (overriding a single row), with values such as top, center, bottom, baseline and axis.
Definition and Usage
Cells in a row can have different heights; rowalign decides whether their contents line up at the top, centre, bottom, baseline or math axis. Supply a single value for all rows or a space-separated list on <mtable> to set each row individually.
Values
| Value | Effect |
|---|---|
| top | Align cell contents to the top of the row. |
| center | Centre cell contents vertically. |
| bottom | Align cell contents to the bottom. |
| baseline | Align cell baselines (default). |
| axis | Align on the math axis. |
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>MathML rowalign attribute</title>
</head>
<body>
<math display="block">
<mtable>
<mtr rowalign="top">
<mtd>
<mfrac><mn>1</mn><mn>2</mn></mfrac>
</mtd>
<mtd><mn>7</mn></mtd>
</mtr>
</mtable>
</math>
</body>
</html>rowalign is part of the MathML table model. Baseline is the default; other values are useful when cells contain fractions or scripts of differing heights.
Key Takeaways
- rowalign sets vertical alignment of cells within rows.
- It applies to <mtable> (default) and <mtr> (override).
- Values include top, center, bottom, baseline and axis.
