MyInternships.in

HTML5 MathML

HTML5 MathML <mi> Tag

The <mi> element represents an identifier - a variable, a constant name, or a function name. Single-letter identifiers are rendered in italics by default, matching mathematical convention.


Definition and Usage

Use <mi> for anything that names a quantity or function: x, y, sin, log, or a constant like e. A single letter is italicised automatically; multi-letter names such as sin are shown upright. Override the style with mathvariant.

Syntax

Identifiers
Example
<mi>x</mi>
<mi>sin</mi>
<mi mathvariant="bold">v</mi>

Attributes

AttributeDescription
mathvariantStyle such as normal, bold, italic, bold-italic, double-struck.
mathsizeFont size of the identifier.
mathcolorText colour of the identifier.
mathbackgroundBackground colour behind the identifier.

Example

Variables and a function name
Example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>MathML mi</title>
</head>
<body>
  <math display="block">
    <mrow>
      <mi>y</mi><mo>=</mo>
      <mi>sin</mi>
      <mo>(</mo><mi>x</mi><mo>)</mo>
    </mrow>
  </math>
</body>
</html>
💡

Set mathvariant="normal" on a single-letter identifier that should stay upright, such as the differential d or a unit symbol.

Key Takeaways

  • <mi> holds identifiers: variables, constants and function names.
  • Single letters are italic by default; multi-letter names are upright.
  • mathvariant overrides the automatic styling.

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