VOOZH about

URL: https://www.geeksforgeeks.org/html/html5-mathml-mathvariant-attribute/

⇱ HTML5 MathML mathvariant Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML5 MathML mathvariant Attribute

Last Updated : 23 Jul, 2025

The MathML mathvariant attribute in HTML5 is used to specify the logical class used for displaying the text. This can be used to vary the typography of the text displayed. All the possible values that this attribute supports are normal, bold, italic, bold-italic, double-struck, bold-fraktur, script, bold-script, fraktur, sans-serif, bold-sans-serif, sans-serif-italic, sans-serif-bold-italic, monospace, initial, tailed, looped, and stretched. This attribute is accepted by the <mi>, <mn>, <mo>, <ms> and <mtext> tags.

Syntax:

<element mathvariant="logical class">

Attribute Values: This attribute has a single value as mentioned above and described below:

  • logical class: This value sets the logical class of the element to one of the available values.

The examples below illustrate the MathML mathvariant attribute:

Example 1: 

Output:

👁 Image

Example 2:

Output:

👁 Image

Supported Browsers: The browsers supported by HTML5 MathML mathvariant attribute are listed below:

  • Firefox
Comment
Article Tags: