MyInternships.in

HTML5 MathML

HTML5 MathML height Attribute

The height attribute sets the height above the baseline for elements that reserve space, such as <mspace> and <mpadded>. It lets you control vertical layout inside a formula.


Definition and Usage

On <mspace>, height defines the height of a blank space. On <mpadded>, it overrides the reported height of the content. Values are lengths - px, em, or keywords - and affect how surrounding elements align.

Syntax

Reserving vertical space
Example
<mspace height="2em" width="0"></mspace>

Example

This inserts a tall blank space that pushes the following content, showing how height affects layout.

A space with explicit height
Example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>MathML height attribute</title>
</head>
<body>
  <math display="block">
    <mrow>
      <mi>a</mi>
      <mspace width="1em" height="2em"></mspace>
      <mi>b</mi>
    </mrow>
  </math>
</body>
</html>
ℹ️

height on <mspace> and <mpadded> is part of MathML Core. For general boxes, CSS height often gives more predictable results.

Key Takeaways

  • height sets the height above the baseline for space-reserving elements.
  • It is most used on <mspace> and <mpadded>.
  • Values are CSS lengths such as px or em.

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