MyInternships.in

HTML5 MathML

HTML5 MathML mathsize Attribute

The mathsize attribute sets the font size of a MathML element's content. It accepts CSS lengths and the keywords small, normal and big, letting you scale individual symbols.


Definition and Usage

Apply mathsize to token elements such as <mi>, <mn> and <mo> to enlarge or shrink them relative to the surrounding formula. Values may be absolute (16px), relative (1.5em, 150%) or the keywords small, normal and big.

Syntax

Setting the font size
Example
<mi mathsize="2em">x</mi>

Example

This makes one variable noticeably larger than the rest of the expression.

Enlarging a symbol
Example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>MathML mathsize attribute</title>
</head>
<body>
  <math display="block">
    <mrow>
      <mi mathsize="2em">&#8721;</mi>
      <mi>x</mi>
    </mrow>
  </math>
</body>
</html>
💡

In MathML Core the CSS font-size property has the same effect as mathsize and is often preferable for consistency with your stylesheet.

Key Takeaways

  • mathsize sets the font size of an element's content.
  • Values include px, em, percentages and small/normal/big.
  • CSS font-size is an equivalent modern approach.

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