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
Example
<mspace height="2em" width="0"></mspace>Example
This inserts a tall blank space that pushes the following content, showing how height affects layout.
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.
