MyInternships.in

HTML5 MathML

HTML5 MathML <mglyph> Tag

The <mglyph> element displays a symbol that is not available as a normal text character - typically an image or a font glyph referenced by other means. It fills gaps where a required mathematical symbol has no Unicode code point in the current font.


Definition and Usage

<mglyph> is an empty (self-contained) element. Historically it referenced an image with src, or a specific glyph via a font. Use it only when no standard character or entity will do, since custom glyphs reduce accessibility and portability.

Attributes

AttributeDescription
srcURL of an image to display as the glyph.
widthRendered width of the glyph.
heightRendered height of the glyph.
altAlternative text describing the glyph.

Example

This uses <mglyph> with an image as a decorative symbol in an expression. If the image fails to load, the alt text is shown.

An mglyph symbol in a formula
Example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>MathML mglyph</title>
</head>
<body>
  <math display="block">
    <mrow>
      <mi>f</mi>
      <mo>=</mo>
      <mglyph src="star.png" width="16px" height="16px" alt="star symbol"></mglyph>
      <mo>+</mo>
      <mn>1</mn>
    </mrow>
  </math>
</body>
</html>
⚠️

<mglyph> is rarely needed today and has patchy support in MathML Core. Prefer Unicode characters or named entities (like &alpha;) whenever possible for accessibility.

Key Takeaways

  • <mglyph> shows a glyph or image not available as a standard character.
  • src points to an image; always supply alt text.
  • Use standard Unicode symbols first - reserve <mglyph> for genuine gaps.

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