MyInternships.in

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

ValueEffect
topAlign cell contents to the top of the row.
centerCentre cell contents vertically.
bottomAlign cell contents to the bottom.
baselineAlign cell baselines (default).
axisAlign on the math axis.

Example

Top-aligned cells in a row
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.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships